Answers an array of options for the image align field.

@return array
504554
public function getImageAlignOptions()
    {
        return [
            self::IMAGE_ALIGN_LEFT => _t(__CLASS__ . '.LEFT', 'Left'),
            self::IMAGE_ALIGN_RIGHT => _t(__CLASS__ . '.LEFT', 'Right'),
            self::IMAGE_ALIGN_STAGGER => _t(__CLASS__ . '.LEFT', 'Stagger')
        ];
    }
384884
public function getAcceptImageMimeTypes()
    {
        $imageAllowFiles = $this->getSetting('imageAllowFiles');
        $extensions = explode(',', $imageAllowFiles);
        array_walk($extensions, function (&$value) {
            $value = 'image/' . $value;
        });
        return $extensions;
    }
15790
public function toArray()
	{
		return array(
			'type' 			=> self::TYPE_ID,
			'id' 			=> $this->imageId,
			'align' 		=> $this->align,
			'style' 		=> $this->style,

			'alternate_text'	=> $this->alternateText,
			'title' 		=> $this->title,
			'description' 	=> $this->description,

			'size_width' 	=> $this->width,
			'size_height' 	=> $this->height,
			'crop_top' 		=> $this->cropTop,
			'crop_left' 	=> $this->cropLeft,
			'crop_width' 	=> $this->cropWidth,
			'crop_height' 	=> $this->cropHeight,

			'size_name' 	=> $this->sizeName,
		);
	}
826406
function get_orientation() {
        if (imagesx($this->image) > imagesy($this->image)) {
            return 'landscape';
        }
        if (imagesx($this->image) < imagesy($this->image)) {
            return 'portrait';
        }
        return 'square';
    }
819619
public function getDefinedUploadFields()
    {
        $fields = isset(static::$imageFields)
            ? static::$imageFields
            : $this->imagesFields;

        return array_merge($this->getDefinedFileFields(), $fields);
    }
1007113
public function getBannerImageSizes()
    {
        $sizes = array();
        $imageSize = $this->Database
                            ->prepare("SELECT id, name, width, height FROM tl_image_size ORDER BY pid, name")
                            ->execute(\Input::get('id'));
        while ($imageSize->next())
        {
            $sizes[$imageSize->id] = $imageSize->name;
            $sizes[$imageSize->id] .= ' (' . $imageSize->width . 'x' . $imageSize->height . ')';
        }
        return array_merge(array('image_sizes'=>$sizes), $GLOBALS['TL_CROP']);
    }
803489
public function getDefaultImageAlignment()
    {
        if ($alignment = $this->owner->ImageDefaultAlignment) {
            return $alignment;
        }
        
        if ($this->owner->hasExtension(MetaDataExtension::class)) {
            return $this->owner->getFieldFromParent('DefaultImageAlignment');
        }
    }
317380
private function _allowedStyles(): array
    {
        $styles = [];
        $plugins = array_flip($this->_getRedactorConfig()['plugins'] ?? []);
        if (isset($plugins['alignment'])) {
            $styles['text-align'] = true;
        }
        if (isset($plugins['fontcolor'])) {
            $styles['color'] = true;
        }
        if (isset($plugins['fontfamily'])) {
            $styles['font-family'] = true;
        }
        if (isset($plugins['fontsize'])) {
            $styles['font-size'] = true;
        }
        return $styles;
    }
180709
protected function getImageStyleFieldsSettings()
    {
        return array(
            'image_style_category' => $this->text('Category page'),
            'image_style_category_child' => $this->text('Category page (child)'),
            'image_style_product' => $this->text('Product page'),
            'image_style_page' => $this->text('Page'),
            'image_style_product_grid' => $this->text('Product catalog (grid)'),
            'image_style_product_list' => $this->text('Product catalog (list)'),
            'image_style_cart' => $this->text('Cart'),
            'image_style_option' => $this->text('Product option'),
            'image_style_collection_file' => $this->text('File collection (banners)'),
            'image_style_collection_page' => $this->text('Page collection (news/articles)'),
            'image_style_collection_product' => $this->text('Product collection (featured products)'),
        );
    }
816495
public function get_styles() {

		// Get an array of all our fields.
		$fields = self::$fields;

		// Check if we need to exit early.
		if ( empty( self::$fields ) || ! is_array( $fields ) ) {
			return;
		}

		// Initially we're going to format our styles as an array.
		// This is going to make processing them a lot easier
		// and make sure there are no duplicate styles etc.
		$css = array();

		// Start parsing our fields.
		foreach ( $fields as $field ) {

			// No need to process fields without an output, or an improperly-formatted output.
			if ( ! isset( $field['output'] ) || empty( $field['output'] ) || ! is_array( $field['output'] ) ) {
				continue;
			}

			// Get the value of this field.
			$value = self::get_option( $field['kirki_config'], $field['settings'] );

			// Start parsing the output arguments of the field.
			foreach ( $field['output'] as $output ) {
				$output = wp_parse_args(
					$output,
					array(
						'element'       => '',
						'property'      => '',
						'media_query'   => 'global',
						'prefix'        => '',
						'units'         => '',
						'suffix'        => '',
						'value_pattern' => '$',
						'choice'        => '',
					)
				);

				// If element is an array, convert it to a string.
				if ( is_array( $output['element'] ) ) {
					$output['element'] = implode( ',', $output['element'] );
				}

				// Simple fields.
				if ( ! is_array( $value ) ) {
					$value = str_replace( '$', $value, $output['value_pattern'] );
					if ( ! empty( $output['element'] ) && ! empty( $output['property'] ) ) {
						$css[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $value . $output['units'] . $output['suffix'];
					}
				} else {
					if ( 'typography' === $field['type'] ) {

						foreach ( $value as $key => $subvalue ) {

							// Add double quotes if needed to font-families.
							if ( 'font-family' === $key && false !== strpos( $subvalue, ' ' ) && false === strpos( $subvalue, '"' ) ) {
								$css[ $output['media_query'] ][ $output['element'] ]['font-family'] = '"' . $subvalue . '"';
							}

							// Variants contain both font-weight & italics.
							if ( 'variant' === $key ) {
								$font_weight = str_replace( 'italic', '', $subvalue );
								$font_weight = ( in_array( $font_weight, array( '', 'regular' ), true ) ) ? '400' : $font_weight;
								$css[ $output['media_query'] ][ $output['element'] ]['font-weight'] = $font_weight;

								// Is this italic?
								if ( false !== strpos( $subvalue, 'italic' ) ) {
									$css[ $output['media_query'] ][ $output['element'] ]['font-style'] = 'italic';
								}
							} else {
								$css[ $output['media_query'] ][ $output['element'] ][ $key ] = $subvalue;
							}
						}
					} elseif ( 'multicolor' === $field['type'] ) {

						if ( ! empty( $output['element'] ) && ! empty( $output['property'] ) && ! empty( $output['choice'] ) ) {
							$css[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $value[ $output['choice'] ] . $output['units'] . $output['suffix'];
						}
					} else {

						foreach ( $value as $key => $subvalue ) {
							$property = $key;
							if ( false !== strpos( $output['property'], '%%' ) ) {
								$property = str_replace( '%%', $key, $output['property'] );
							} elseif ( ! empty( $output['property'] ) ) {
								$output['property'] = $output['property'] . '-' . $key;
							}
							if ( 'background-image' === $output['property'] && false === strpos( $subvalue, 'url(' ) ) {
								$subvalue = 'url("' . set_url_scheme( $subvalue ) . '")';
							}
							if ( $subvalue ) {
								$css[ $output['media_query'] ][ $output['element'] ][ $property ] = $subvalue;
							}
						}
					}
				}
			}
		}

		// Process the array of CSS properties and produce the final CSS.
		$final_css = '';
		if ( ! is_array( $css ) || empty( $css ) ) {
			return '';
		}

		// Parse the generated CSS array and create the CSS string for the output.
		foreach ( $css as $media_query => $styles ) {

			// Handle the media queries.
			$final_css .= ( 'global' !== $media_query ) ? $media_query . '{' : '';
			foreach ( $styles as $style => $style_array ) {

				$final_css .= $style . '{';
				foreach ( $style_array as $property => $value ) {

					$value = ( is_string( $value ) ) ? $value : '';

					// Make sure background-images are properly formatted.
					if ( 'background-image' === $property ) {
						if ( false === strrpos( $value, 'url(' ) ) {
							$value = set_url_scheme( $value );
							$value = 'url("' . esc_url_raw( $value ) . '")';
						}
					} else {
						$value = esc_textarea( $value );
					}
					$final_css .= $property . ':' . $value . ';';
				}
				$final_css .= '}';
			}
			$final_css .= ( 'global' !== $media_query ) ? '}' : '';
		}
		return $final_css;
	}
966035
public function getOrientation()
    {
        $width = $this->getWidth();
        $height = $this->getHeight();
        if ($width > $height) {
            return Image_Backend::ORIENTATION_LANDSCAPE;
        } elseif ($height > $width) {
            return Image_Backend::ORIENTATION_PORTRAIT;
        } else {
            return Image_Backend::ORIENTATION_SQUARE;
        }
    }
322285
public function getCMSFields() {

        $fields = parent::getCMSFields();

        $fields->addFieldsToTab('Root.Gallery', [

            UploadField::create(
                'GalleryImages',
                'Gallery Images'
            )
            ->setFolderName('gallery-images')
            ->setAllowedExtensions(['jpg', 'jpeg', 'png', 'gif', 'bmp'])

        ]);

        return $fields;
    }
823862
public function correctOrientation()
    {
        try {
            $exif = exif_read_data($this->file);
        } catch (\Exception $e) {
            return $this;
        }
        if (!empty($exif['Orientation'])) {
            switch ($exif['Orientation']) {
                case 8:
                    $this->image = imagerotate($this->image, 90, 0);
                    break;
                case 3:
                    $this->image = imagerotate($this->image, 180, 0);
                    break;
                case 6:
                    $this->image = imagerotate($this->image, -90, 0);
                    break;
            }
        }
        return $this;
    }
338961
public function attributes(): array
    {
        $attributes = [];

        if (!$this->isExternal() || $this->fileExists()) {
            $file = $this->folder() . $this->multimedia_file_refn;

            $attributes['__FILE_SIZE__'] = $this->fileSizeKB();

            $imgsize = getimagesize($file);
            if (is_array($imgsize) && !empty($imgsize['0'])) {
                $attributes['__IMAGE_SIZE__'] = I18N::translate('%1$s × %2$s pixels', I18N::number($imgsize['0']), I18N::number($imgsize['1']));
            }
        }

        return $attributes;
    }
190262
private function getImageExtensionConstant()
    {
        $retour = [];
        if (empty($this->const_imagExt)) {
            $constants = $this->getConstants();
            foreach ($constants as $key => $constant) {
                $pos = strpos($key, 'EXT_IMAG');
                if ($pos !== false) {
                    $retour[$key] = $constant;
                }
            }
            $this->const_imagExt = $retour;
        } else {
            $retour = $this->const_imagExt;
        }
        return $retour;
    }
319686
public function getImages() {
    	// Sort array
    	$images = array();
    	if (isset($this->_headerFooterImages[self::IMAGE_HEADER_LEFT])) 	$images[self::IMAGE_HEADER_LEFT] = 		$this->_headerFooterImages[self::IMAGE_HEADER_LEFT];
    	if (isset($this->_headerFooterImages[self::IMAGE_HEADER_CENTER])) 	$images[self::IMAGE_HEADER_CENTER] = 	$this->_headerFooterImages[self::IMAGE_HEADER_CENTER];
    	if (isset($this->_headerFooterImages[self::IMAGE_HEADER_RIGHT])) 	$images[self::IMAGE_HEADER_RIGHT] = 	$this->_headerFooterImages[self::IMAGE_HEADER_RIGHT];
    	if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_LEFT])) 	$images[self::IMAGE_FOOTER_LEFT] = 		$this->_headerFooterImages[self::IMAGE_FOOTER_LEFT];
    	if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_CENTER])) 	$images[self::IMAGE_FOOTER_CENTER] = 	$this->_headerFooterImages[self::IMAGE_FOOTER_CENTER];
    	if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_RIGHT])) 	$images[self::IMAGE_FOOTER_RIGHT] = 	$this->_headerFooterImages[self::IMAGE_FOOTER_RIGHT];
    	$this->_headerFooterImages = $images;

    	return $this->_headerFooterImages;
    }
360191
protected function getSelectionParams()
    {
        $result = $this->getSession('media_crop_selection_params');

        if ($result) {
            if (!isset($result['mode'])) {
                $result['mode'] = self::SELECTION_MODE_NORMAL;
            }

            if (!isset($result['width'])) {
                $result['width'] = null;
            }

            if (!isset($result['height'])) {
                $result['height'] = null;
            }

            return $result;
        }

        return [
            'mode'   => self::SELECTION_MODE_NORMAL,
            'width'  => null,
            'height' => null
        ];
    }