Returns the current image in a field.
This is meant to be used with image uploads so that users can see the current value.

@param type $FieldName
@param type $Attributes
@since 2.1
1595
public function CurrentImage($FieldName, $Attributes = array()) {
      $Result = $this->Hidden($FieldName);
      
      $Value = $this->GetValue($FieldName);
      if ($Value) {
         TouchValue('class', $Attributes, 'CurrentImage');
         $Result .= Img(Gdn_Upload::Url($Value), $Attributes);
      }
      
      return $Result;
   }
234377
public function getFieldValue($fieldName)
    {
        if (!$this->hasField($fieldName)) {
            throw new RuntimeException('Field "' . $fieldName . '" not found in Plugin Configuration');
        }

        return $this->configuration['fields'][$fieldName]['data'];
    }
225042
public function getImage()
    {
        // No fields, no image.
        if (empty($this->contenttype['fields'])) {
            return '';
        }

        // Grab the first field of type 'image', and return that.
        foreach ($this->contenttype['fields'] as $key => $field) {
            if ($field['type'] === 'image' && isset($this->values[$key])) {
                // After v1.5.1 we store image data as an array
                if (is_array($this->values[$key])) {
                    return isset($this->values[$key]['file']) ? $this->values[$key]['file'] : '';
                }

                return $this->values[$key];
            }
        }

        // otherwise, no image.
        return '';
    }
480980
public function addField($fieldName, Field $field)
    {
        $this->fieldNames[ $fieldName ] = $fieldName;
        $this->fields[ $fieldName ]     = $field;

        return $fieldName;
    }
197360
protected function getFieldValue(array $attr, $field)
    {
        $method = 'set' . ucwords($field);

        if (method_exists($this, $method)) {
            // If there is a setter for this field, use that
            return $this->{$method}($attr[$field]);
        }

        // Otherwise just set the property
        return (isset($attr[$field])) ? $attr[$field] : null;
    }
242335
public function getImage($type, $size, array $attributes = array())
	{
		if (empty($this->$type))
		{
			return null;
		}
		$html = '<img src="' . $this->getImageSrc($type, $size) . '"';
		$html .= ' alt="' . $this->{$type.'_alt'} . '"';
		$html .= ' width="' . $this->getImageWidth($type, $size) . '"';
		$html .= ' height="' . $this->getImageHeight($type, $size) . '"';
		
		$html_attributes = '';
		if (!empty($attributes)) {
			$html_attributes = join(' ', array_map(function($key) use ($attributes) {
				if(is_bool($attributes[$key]))
				{
					return $attributes[$key] ? $key : '';
				}
				return "{$key}=\"{$attributes[$key]}\"";
			}, array_keys($attributes)));
		}
		
		return $html;
	}
636820
public static function input($field, $value = null, array $attributes = array())
	{
		return static::$instance->input($field, $value, $attributes);
	}
651485
@Api
	public void getValue(String name, ImageUrlAttribute attribute) {
		attribute.setValue((String) formWidget.getValue(name));
	}
281159
public function & GetField ($fieldName = '') {
		$result = NULL;
		if (isset($this->fields[$fieldName]))
			$result = & $this->fields[$fieldName];
		return $result;
	}
1326370
public function getFieldNum($fieldName)
    {
        foreach( $this->_fields as $field ) {
            if( $field->name == $fieldName ) {
                return $field->number;
            }
        }

        return -1;
    }
492673
public void getImageAttributes(Map<String, String> attributes, I_CmsSimpleCallback<Map<String, String>> callback) {

        if (getGalleryMode() == GalleryMode.editor) {
            m_imageEditorFormatsTab.getImageAttributes(attributes);
            m_imageAdvancedTab.getImageAttributes(attributes, callback);
        } else {
            callback.execute(attributes);
        }
    }
123785
public Attribute<T, Serializable> getAttribute(String fieldname) {
        if (fieldname == null) return null;
        return this.attributeMap.get(fieldname);
    }
923067
public static function inputImage(string $name = '', string $src = '', array $attributes = []): string
    {
        $defaultAttributes = ['method-get' => false, 'class' => 'formImage'];
        $userAttributes = \array_merge($defaultAttributes, $attributes);
        $attributes = [];
        $attributes['type'] = 'image';
        $attributes['name'] = $userAttributes['method-get'] === false ? \sprintf('MFVARS[%s]', $name) : $name;
        $attributes['src'] = $src;
        $attributes['id'] = isset($userAttributes['id']) ? $userAttributes['id'] : $name;
        $userAttributes = static::clearAttributes($userAttributes, ['method-get', 'id']);

        return Tags::input(\array_merge($attributes, $userAttributes));
    }
321892
public static function image(string $file, array $attributes = null) : string
    {
        // Add the image link
        $attributes['src'] = $file;
        $attributes['alt'] = (isset($attributes['alt'])) ? $attributes['alt'] : pathinfo($file, PATHINFO_FILENAME);

        return '<img'.Html::attributes($attributes).'>';
    }
322128
protected function getAttributesByFieldNameAndValues(string $fieldName, $values)
    {
        $attributes = [];

        if (empty($values) || empty($this->attributes)) {
            return $attributes;
        }

        foreach ($this->attributes as $attribute) {
            if (in_array($attribute->{$fieldName}, $values)) {
                $attributes[] = $attribute;
            }
        }

        return $attributes;
    }
1321293
public function srcset($attributes = [])
    {
        if ($images = $this->transformed) {
            $widths = [];
            $result = '';

            foreach ($images as $image) {
                $keys  = array_keys($image);
                $width = $image['width'] ?? $image['w'] ?? null;
                if ($width && !isset($widths[ $width ])) {
                    $withs[ $width ] = true;
                    $result          .= $image['url'] . ' ' . $width . 'w, ';
                }
            }

            $srcset   = substr($result, 0, strlen($result) - 2);
            $lazyLoad = false;

            if (isset($attributes['lazyLoad'])) {
                $lazyLoad = $attributes['lazyLoad'];
                unset($attributes['lazyLoad']); // unset to remove it from the html output
            }

            $tagAttributes = $this->getTagAttributes($attributes);

            return Template::raw('<img ' . ($lazyLoad ? $this->lazyLoadPrefix : '') . 'src="' . $images[0]['url'] . '" ' . ($lazyLoad ? $this->lazyLoadPrefix : '') . 'srcset="' . $srcset . '" ' . $tagAttributes . ' />');
        }

        return null;
    }
1068834
public function getUploadFieldName($field = null)
    {
        if (!is_null($field)) {
            return $field;
        }

        $imagesFields = $this->getDefinedUploadFields();
        $fieldKey = array_first(array_keys($imagesFields));

        // return first field name
        return is_int($fieldKey)
            ? $imagesFields[$fieldKey]
            : $fieldKey;
    }