Scan image standrad infos

@return array An array of retrieved image's infos
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;
    }
509457
public static function getImageInfo($image)
    {
        $imagesInfoArr = @getimagesize($image);
        if (!$imagesInfoArr) return false;
        list($imagesInfo['width'], $imagesInfo['height'], $imagesInfo['ext']) = $imagesInfoArr;
        $imagesInfo['ext'] = strtolower(ltrim(image_type_to_extension($imagesInfo['ext']), '.'));
        return $imagesInfo;
    }
732404
private function getImageData()
    {
        ob_start();
        imagegif($this->image);
        $output = ob_get_contents();
        ob_end_clean();
        imagedestroy($this->image);

        return $output;
    }
562077
protected function scanner()
    {
        if (isset($this->scanner)) {
            return $this->scanner;
        }
        $this->scanner = new AssetScanner(
            $this->_settings['paths'],
            isset($this->_settings['theme']) ? $this->_settings['theme'] : null
        );

        return $this->scanner;
    }
457496
public function getInfo()
    {

        $file_info = @getimagesize($this->path);

        //define the original width of the image
        $this->width['orig'] = $file_info['0'];

        //define the original height of the image
        $this->height['orig'] = $file_info['1'];

        //image type //1 = GIF, 2 = JPG, 3 = PNG, 4 = SWF, 5 = PSD, 6 = BMP, 7 = TIFF(intel byte order), 8 = TIFF(motorola byte order), 9 = JPC, 10 = JP2, 11 = JPX, 12 = JB2, 13 = SWC, 14 = IFF, 15 = WBMP, 16 = XBM

        switch ($file_info[2])

    {
            case "1":
                $this->type = "gif";
            break;

            case "2":
                $this->type = "jpg";
            break;

            case "3":
                $this->type = "png";
            break;
        }
        //////////////////////////
        $this->original = imagecreatefromstring(file_get_contents($this->path));

    }
1247062
protected function getImages()
    {
        $table = ORM::getTable($this->getTable()->getPlugin(), 'Image');
        $q = $table->createSelectQuery();
        $q->where(
            $q->expr->lAnd(
                $q->expr->eq('groupId', $q->bindValue($this->id, null, PDO::PARAM_INT)),
                $q->expr->eq('active', $q->bindValue(true, null, PDO::PARAM_BOOL))
            )
        );
        $q->orderBy('position');
        return $table->loadFromQuery($q);
    }
1172822
public function getImageDimensions()
    {
        $dimension = $this->getData()->chained->getComponent()->_getSetting('dimension');
        if ($this->getData()->chained->getComponent()->getRow()->use_crop) {
            $parentDimensions = $this->_getImageEnlargeComponent()->getImageDimensions();
            $dimension['crop'] = $parentDimensions['crop'];
        }
        $data = $this->getImageData();
        return Kwf_Media_Image::calculateScaleDimensions($data['file'], $dimension);
    }
688051
public function getImages()
    {
        $images = array();

        $nodes = $this->html->findTags('img');
        foreach ($nodes as $node) {
            $source = trim($node->getAttribute('src'));

            if (empty($source)) {
                continue;
            }

            $url = $this->getAbsoluteUrl($source);
            $size = $this->getImageSize($url);

            if (is_array($size)) {
                list($width, $height) = $size;
            } else {
                continue;
            }

            if ($this->isImageAccepted($url, $width, $height)) {
                $images[] = array(
                    'url'    => $url,
                    'width'  => $width,
                    'height' => $height,
                    'area'   => ($width * $height)
                );
            }
        }

        return $images;
    }
515202
public function scan()
    {
        $reflector = new ReflectionClass($this->parser);

        // Prime parser. Do things not appropriate to do in constructor. Most OS classes
        // don't have this.
        if ($reflector->hasMethod('init') && ($method = $reflector->getMethod('init'))) {
            $method->invoke($this->parser);
        }

        // Array fields, tied to method names and default values...
        $fields = array(
            'OS' => array(
                'show' => !empty($this->settings['show']['os']),
                'default' => '',
                'method' => 'getOS',
            ),

            'Kernel' => array(
                'show' => !empty($this->settings['show']['kernel']),
                'default' => '',
                'method' => 'getKernel',
            ),

            'AccessedIP' => array(
                'show' => !isset($this->settings['show']['ip']) || !empty($this->settings['show']['ip']),
                'default' => '',
                'method' => 'getAccessedIP',
            ),

            'Distro' => array(
                'show' => !empty($this->settings['show']['distro']),
                'default' => '',
                'method' => 'getDistro',
            ),

            'RAM' => array(
                'show' => !empty($this->settings['show']['ram']),
                'default' => [],
                'method' => 'getRam',
            ),

            'HD' => array(
                'show' => !empty($this->settings['show']['hd']),
                'default' => [],
                'method' => 'getHD',
            ),

            'Mounts' => array(
                'show' => !empty($this->settings['show']['mounts']),
                'default' => [],
                'method' => 'getMounts',
            ),

            'Load' => array(
                'show' => !empty($this->settings['show']['load']),
                'default' => [],
                'method' => 'getLoad',
            ),

            'HostName' => array(
                'show' => !empty($this->settings['show']['hostname']),
                'default' => '',
                'method' => 'getHostName',
            ),

            'UpTime' => array(
                'show' => !empty($this->settings['show']['uptime']),
                'default' => [],
                'method' => 'getUpTime',
            ),

            'CPU' => array(
                'show' => !empty($this->settings['show']['cpu']),
                'default' => [],
                'method' => 'getCPU',
            ),

            'Model' => array(
                'show' => !empty($this->settings['show']['model']),
                'default' => [],
                'method' => 'getModel',
            ),

            'CPUArchitecture' => array(
                'show' => !empty($this->settings['show']['cpu']),
                'default' => '',
                'method' => 'getCPUArchitecture',
            ),

            'Network Devices' => array(
                'show' => !empty($this->settings['show']['network']),
                'default' => [],
                'method' => 'getNet',
            ),

            'Devices' => array(
                'show' => !empty($this->settings['show']['devices']),
                'default' => [],
                'method' => 'getDevs',
            ),

            'Temps' => array(
                'show' => !empty($this->settings['show']['temps']),
                'default' => [],
                'method' => 'getTemps',
            ),

            'Battery' => array(
                'show' => !empty($this->settings['show']['battery']),
                'default' => [],
                'method' => 'getBattery',
            ),

            'Raid' => array(
                'show' => !empty($this->settings['show']['raid']),
                'default' => [],
                'method' => 'getRAID',
            ),

            'Wifi' => array(
                'show' => !empty($this->settings['show']['wifi']),
                'default' => [],
                'method' => 'getWifi',
            ),

            'SoundCards' => array(
                'show' => !empty($this->settings['show']['sound']),
                'default' => [],
                'method' => 'getSoundCards',
            ),

            'processStats' => array(
                'show' => !empty($this->settings['show']['process_stats']),
                'default' => [],
                'method' => 'getProcessStats',
            ),

            'services' => array(
                'show' => !empty($this->settings['show']['services']),
                'default' => [],
                'method' => 'getServices',
            ),

            'numLoggedIn' => array(
                'show' => !empty($this->settings['show']['numLoggedIn']),
                'default' => false,
                'method' => 'getnumLoggedIn',
            ),

            'virtualization' => array(
                'show' => !empty($this->settings['show']['virtualization']),
                'default' => [],
                'method' => 'getVirtualization',
            ),

            'cpuUsage' => array(
                'show' => !empty($this->settings['cpu_usage']),
                'default' => false,
                'method' => 'getCPUUsage',
            ),

            'phpVersion' => array(
                'show' => !empty($this->settings['show']['phpversion']),
                'default' => false,
                'method' => 'getPhpVersion',
            ),

            'webService' => array(
                'show' => !empty($this->settings['show']['webservice']),
                'default' => false,
                'method' => 'getWebService',
            ),

            // Extra info such as which fields to not show
            'contains' => array(
                'show' => true,
                'default' => [],
                'method' => 'getContains',
            ),
        );

        foreach ($fields as $key => $data) {
            if (!$data['show']) {
                $this->info[$key] = $data['default'];
                continue;
            }

            try {
                $method = $reflector->getMethod($data['method']);
                $this->info[$key] = $method->invoke($this->parser);
            } catch (ReflectionException $e) {
                $this->info[$key] = $data['default'];
            }
        }

        // Add a timestamp
        $this->info['timestamp'] = date('c');

        // Run extra extensions
        $this->runExtensions();
    }
1239991
private function getAllInfo()
    {
        $data = [];
        $picture_table = $this->_parser->find('table', 0);
        if ($picture_table) {
            foreach ($picture_table->find('img') as $each_picture) {
                if ($each_picture) {
                    $data[] = $each_picture->src;
                }
            }
        }

        return $data;
    }
186100
public function getFileInfo()
    {
        $ret = array(
            'uploadId' => $this->id,
            'mimeType' => $this->mime_type,
            'filename' => $this->filename,
            'extension'=> $this->extension,
            'fileSize' => $this->getFileSize(),
            'hashKey'  => $this->getHashKey()
        );
        if (!$this->id && is_file($this->filename)) {
            $ret['mimeType'] = $this->_getMimeType($this->filename);
            $ret['extension'] = substr(strrchr($this->filename, '.'), 1);
        }
        $size = $this->getImageDimensions();
        if ($size) {
            $ret['image'] = true;
            $ret['imageHandyScaleFactor'] = Kwf_Media_Image::getHandyScaleFactor($size);
            if (abs($size['rotation']) == 90) {
                $size = array('width'=>$size['height'], 'height'=>$size['width']);
            }
            $ret['imageWidth'] = $size['width'];
            $ret['imageHeight'] = $size['height'];
        } else {
            $ret['image'] = false;
        }
        return $ret;
    }
885040
public function getSortedImages()
    {
        $imagesSort = explode(',', $this->getImagesSort());
        $orderCollection = array_reverse($imagesSort);
        $imagesCollection = $this
            ->getImages()
            ->toArray();

        usort(
            $imagesCollection,
            function (
                \Elcodi\Component\Media\Entity\Interfaces\ImageInterface $a,
                \Elcodi\Component\Media\Entity\Interfaces\ImageInterface $b
            ) use ($orderCollection) {

                $aPos = array_search($a->getId(), $orderCollection);
                $bPos = array_search($b->getId(), $orderCollection);

                return ($aPos < $bPos)
                    ? 1
                    : -1;
            }
        );

        return new ArrayCollection($imagesCollection);
    }
441221
public function getImageAttributes()
    {
        $attributes = [
            'src' => $this->ImageURL,
            'class' => $this->ImageClass,
            'title' => $this->ImageTitleText,
            'alt' => $this->ImageAltText
        ];
        
        if ($this->hasVectorImage()) {
            
            if ($width = $this->ImageResizeWidth) {
                $attributes['width'] = $width;
            }
            
            if ($height = $this->ImageResizeHeight) {
                $attributes['height'] = $height;
            }
            
        }
        
        $this->extend('updateImageAttributes', $attributes);
        
        return $attributes;
    }
4423
public function getDimensions(): array
    {
        if ($this->dimensions === null) {
            $this->dimensions = getimagesize($this->file->getPathname());
        }

        return $this->dimensions;
    }
1045199
protected function scanArchive()
    {
        $information = $this->archive->getArchiveInformation();
        $this->files = $information->files;
        $this->compressedFilesSize = $information->compressedFilesSize;
        $this->uncompressedFilesSize = $information->uncompressedFilesSize;
        $this->filesQuantity = count($information->files);
    }
260407
public function scan()
    {
        $paths = $this->getScanPaths();

        $components = [];

        foreach ($paths as $key => $path) {
            $manifests = $this->app['files']->glob("{$path}/component.json");

            is_array($manifests) || $manifests = [];

            foreach ($manifests as $manifest) {
                $name = Json::make($manifest)->get('name');

                $components[$name] = new Component($this->app, $name, dirname($manifest));
            }
        }

        return $components;
    }
328706
public function getExifInfos()
    {
        if (!$this->exists()) {
            return false;
        }
        $exifdata = array();
        if ($data = exif_read_data($this->getRealPath(), 'EXIF', true)) {
            foreach ($data as $key => $section) {
                foreach ($section as $name => $value) {
                    if (is_string($value)) {
                        if (!isset($exifdata[$name])) {
                            $exifdata[$name] = '';
                        }
                        $exifdata[$name] .= $value;
                    } elseif (is_array($value)) {
                        if (!isset($exifdata[$name])) {
                            $exifdata[$name] = array();
                        }
                        $exifdata[$name][] = $value;
                    }
                }
            }
            if (!empty($exifdata["GPSLongitude"]) && !empty($exifdata['GPSLongitudeRef'])) {
                $exifdata["GPSLongitudeTransformed"] = self::getGps($exifdata["GPSLongitude"][0], $exifdata['GPSLongitudeRef'][0]);
            }
            if (!empty($exifdata["GPSLatitude"]) && !empty($exifdata['GPSLatitudeRef'])) {
                $exifdata["GPSLatitudeTransformed"] = self::getGps($exifdata["GPSLatitude"][0], $exifdata['GPSLatitudeRef'][0]);
            }
            if (!empty($exifdata["DateTime"])) {
                $exifdata["DateTimeTransformed"] = self::getDateFromExif($exifdata["DateTime"]);
            }
            if (!empty($exifdata["DateTimeOriginal"])) {
                $exifdata["DateTimeOriginalTransformed"] = self::getDateFromExif($exifdata["DateTimeOriginal"]);
            }
        }
        return $exifdata;
    }