Returns an array of supported image formats
@return array
769345
public function getSupportedFormats()
    {
        $formats = array();

        foreach (gd_info() as $name => $status) {
            if (strpos($name, 'Support') !== false && $status) {
                $formats[] = strtolower(strtok($name, ' '));
            }
        }

        return array_unique($formats);
    }
375126
public function getFormats()
    {
        $allFormats = array();

        foreach ($this->loaderIds as $id => $formats) {
            foreach ($formats as $format) {
                if ('database' !== $format) {
                    $allFormats[] = $format;
                }
            }
        }

        return $allFormats;
    }
500577
public function getFormats()
    {
        return [
            'date'     => $this->getDateFormatHelper()->getFormatsDate(),
            'datetime' => $this->getDateFormatHelper()->getFormatsDateTime(),
            'time'     => $this->getDateFormatHelper()->getFormatsTime(),
            'number'   => $this->formatNumber,
            'boolean'  => $this->formatBoolean,
            'string'   => $this->formatString,
            'region'   => $this->formatString,
            'tel'      => $this->formatTel,
            'text'     => $this->formatText,
            'email'    => $this->formatEmail,
        ];
    }
1276871
public function photos()
    {
        $links[] = [__d('me_cms', 'List photos'), [
            'controller' => 'Photos',
            'action' => 'index',
            'plugin' => 'MeCms',
            'prefix' => ADMIN_PREFIX,
        ]];
        $links[] = [__d('me_cms', 'Upload photos'), [
            'controller' => 'Photos',
            'action' => 'upload',
            'plugin' => 'MeCms',
            'prefix' => ADMIN_PREFIX,
        ]];
        $links[] = [__d('me_cms', 'List albums'), [
            'controller' => 'PhotosAlbums',
            'action' => 'index',
            'plugin' => 'MeCms',
            'prefix' => ADMIN_PREFIX,
        ]];
        $links[] = [__d('me_cms', 'Add album'), [
            'controller' => 'PhotosAlbums',
            'action' => 'add',
            'plugin' => 'MeCms',
            'prefix' => ADMIN_PREFIX,
        ]];

        return [$links, I18N_PHOTOS, ['icon' => 'camera-retro']];
    }
1315746
protected function getListImageStyle()
    {
        $id = $this->getParam(0);

        if (!isset($id)) {
            $list = $this->image_style->getList();
            $this->limitArray($list);
            return $list;
        }

        if (!is_numeric($id)) {
            $this->errorAndExit($this->text('Invalid argument'));
        }

        $result = $this->image_style->get($id);

        if (empty($result)) {
            $this->errorAndExit($this->text('Unexpected result'));
        }

        return array($result);
    }
304232
public function toNative()
    {
        if ($this->valueEquals($this->getAttribute()->getNullValue())) {
            return [];
        }

        $images = [];
        foreach ($this->getValue() as $image) {
            $images[] = $image->toNative();
        }

        return $images;
    }
779801
public function getDimensionKeys()
    {
        $dimensions = Config::get('imageupload.dimensions');

        $fillable = [];

        if (empty($dimensions) || ! is_array($dimensions)) {
            return $fillable;
        }

        foreach ($dimensions as $name => $dimension) {
            foreach ($this->thumbnailKeys as $key => $cast) {
                array_push($fillable, $name.'_'.$key);
            }
        }

        return $fillable;
    }
637543
protected function getConfiguredFormat()
    {
        $format = $this->config->get('concrete.misc.default_thumbnail_format');
        if ($format === static::FORMAT_AUTO || $this->bitmapFormat->isFormatValid($format)) {
            $result = $format;
        } elseif ($format === 'jpg') { // legacy value
            $result = BitmapFormat::FORMAT_JPEG;
        } else {
            $result = static::FORMAT_AUTO;
        }

        return $result;
    }
998847
private function getThemeImageSizes()
    {
        $dataProvider = new DefaultDataProvider();
        $dataProvider->setBaseConfig(['source' => 'tl_image_size']);

        $config = $dataProvider->getEmptyConfig();
        $config->setFields(['id', 'name', 'width', 'height']);
        $config->setSorting(['pid', 'name']);

        $collection = $dataProvider->fetchAll($config);
        if (!$collection->count()) {
            return [];
        }

        $sizes = [];
        foreach ($collection as $model) {
            $sizes[$model->getProperty('id')] = sprintf(
                '%s (%sx%s)',
                $model->getProperty('name'),
                $model->getProperty('width'),
                $model->getProperty('height')
            );
        }

        return $sizes;
    }
12175
public function getImageInfos()
    {
        if (!$this->exists()) {
            return false;
        }
        $data = getimagesize($this->getRealPath());
        $result = array();
        if (!empty($data)) {
            if (!empty($data[0])) {
                $result['width'] = $data[0];
            }
            if (!empty($data[1])) {
                $result['height'] = $data[1];
            }
            if (!empty($data[2])) {
                $result['type'] = $data[2];
            }
            if (!empty($data[3])) {
                $result['style'] = $data[3];
            }
            if (!empty($data['channels'])) {
                $result['channels'] = $data['channels'];
                if ($data['channels']===3) {
                    $result['colors'] = 'RGB';
                }
                if ($data['channels']===4) {
                    $result['colors'] = 'CMYK';
                }
            }
            if (!empty($data['mime'])) {
                $result['mime'] = $data['mime'];
            }
            if (!empty($data['bytes'])) {
                $result['bytes'] = $data['bytes'];
            }
        }
        return $result;
    }
1212432
protected function getAcceptFileTypes()
    {
        $extensions = $this->getValidator()->getAllowedExtensions();
        if (!$extensions) {
            return [];
        }

        $accept = [];
        $mimeTypes = HTTP::config()->uninherited('MimeTypes');
        foreach ($extensions as $extension) {
            $accept[] = ".{$extension}";
            // Check for corresponding mime type
            if (isset($mimeTypes[$extension])) {
                $accept[] = $mimeTypes[$extension];
            }
        }

        return array_unique($accept);
    }
84347
public function toArray()
    {
        return array(
            'filter' => $this->getFilter(),
            'width' => $this->getWidth(),
            'height' => $this->getHeight(),
            'percent' => $this->getPercent(),
            'dummy' => $this->getDummy(),
            'border' => $this->getBorder(),
            'layer' => $this->getLayer(),
            'quality' => $this->getQuality(), 
            'crop' => $this->getCrop(),
            'x' => $this->getX(),
            'y' => $this->getY(),
            'rotate' => $this->getRotate(),
            'gravity' => $this->getGravity(), 
            'extension' => $this->getExtension(),
            'filename' => $this->getFilename(),
        );
    }
1070538
public static function getFormats() : array
    {
        return [
            self::FORMAT_GSM => self::FORMAT_GSM,
            self::FORMAT_UNICODE => self::FORMAT_UNICODE,
            self::FORMAT_BINARY => self::FORMAT_BINARY,
            self::FORMAT_WAPPUSH => self::FORMAT_WAPPUSH,
            self::FORMAT_MMS => self::FORMAT_MMS
        ];
    }
479799
protected static function fetch_supported_formats() {
        global $CFG;

        if (!isset(self::$formats)) {
            // Ask unoconv for it's list of supported document formats.
            $cmd = escapeshellcmd(trim($CFG->pathtounoconv)) . ' --show';
            $pipes = array();
            $pipesspec = array(2 => array('pipe', 'w'));
            $proc = proc_open($cmd, $pipesspec, $pipes);
            $programoutput = stream_get_contents($pipes[2]);
            fclose($pipes[2]);
            proc_close($proc);
            $matches = array();
            preg_match_all('/\[\.(.*)\]/', $programoutput, $matches);

            $formats = $matches[1];
            self::$formats = array_unique($formats);
        }

        return self::$formats;
    }
941137
public final function supported_formats() {
        $basic = $this->base_supported_formats();
        if (empty($this->supportedformats)) {
            $specific = array();
        } else if (!is_array($this->supportedformats)) {
            debugging(get_class($this) . ' has set a non array value of member variable supported formats - working around but should be fixed in code');
            $specific = array($this->supportedformats);
        } else {
            $specific = $this->supportedformats;
        }
        return portfolio_most_specific_formats($specific, $basic);
    }
595946
public function getImages()
    {
        $result = [];
        if ($this->getImage()) {
            $result[] = $this->getImage();
        }

        if (null == $this->getDOMDocument()) {
            return $result;
        }

        foreach ($this->getDOMDocument()->getElementsByTagName('img') as $img) {
            if ($src = $img->getAttribute('src')) {
                $result[] = $src;
            }
        }

        if ($this->configuration->getFixRelativeURLs()) {
            foreach ($result as &$imgSrc) {
                $imgSrc = $this->toAbsoluteURI($imgSrc);
            }
        }

        $result = array_unique(array_filter($result));

        return $result;
    }
911730
public function getImageLinkAttributes()
    {
        // Detect Media Type:
        
        if ($this->MediaType == 'photo') {
            
            // Answer Photo Attributes:
            
            return [
                'href' => $this->ImageURL,
                'data-title' => $this->ImageTitleText,
                'data-footer' => $this->ImageCaptionText,
                'data-toggle' => 'lightbox',
                'class' => 'image'
            ];
            
        }
        
        // Answer Standard Attributes:
        
        return [
            'href' => $this->MediaURL,
            'class' => 'image'
        ];
    }