src/Helper/ToolboxFile.php
private function processFile($fileName)
    {
        $file  = new File($fileName);
        $meta  = $this->metaInformation[dirname($fileName)][$file->basename];
        $title = strlen($meta['title']) ? $meta['title'] : StringUtil::specialchars($file->basename);
        if (strlen($meta['caption'])) {
            $altText = $meta['caption'];
        } else {
            $altText = ucfirst(str_replace('_', ' ', preg_replace('/^[0-9]+_/', '', $file->filename)));
        }

        $information = [
            'file'      => $fileName,
            'mtime'     => $file->mtime,
            'alt'       => $altText,
            'caption'   => (!empty($meta['caption']) ? $meta['caption'] : ''),
            'title'     => $title,
            'metafile'  => $meta,
            'icon'      => 'assets/contao/images/' . $file->icon,
            'extension' => $file->extension,
            'size'      => $file->filesize,
            'sizetext'  => sprintf('(%s)', Controller::getReadableSize($file->filesize, 2)),
            'url'       => StringUtil::specialchars($this->getDownloadLink($fileName))
        ];

        // Prepare GD images.
        if ($information['isGdImage'] = $file->isGdImage) {
            $information['src'] = urldecode($this->resizeImage($fileName));
            if (file_exists(TL_ROOT . '/' . $information['src'])) {
                $size              = getimagesize(TL_ROOT . '/' . $information['src']);
                $information['lb'] = 'lb' . $this->getLightboxId();
                $information['w']  = $size[0];
                $information['h']  = $size[1];
                $information['wh'] = $size[3];
            }
        }

        // Prepare SVG images.
        if ($information['isSvgImage'] = $file->isSvgImage) {
            $information['src'] = $fileName;
        }

        // Prepare the picture for provide the image size.
        if ($information['isPicture'] = (int) $this->resizeImages[2]) {
            $picture = Picture::create($file, $this->getResizeImages())->getTemplateData();

            $picture['alt']   = $altText;
            $picture['title'] = $title;

            $information['picture'] = $picture;
        }

        $this->modifiedTime[] = $file->mtime;
        $this->outputBuffer[] = $information;
    }
private function processFile($fileName)
    {
        $file  = new File($fileName);
        $meta  = $this->metaInformation[dirname($fileName)][$file->basename];
        $title = strlen($meta['title']) ? $meta['title'] : StringUtil::specialchars($file->basename);
        if (strlen($meta['caption'])) {
            $altText = $meta['caption'];
        } else {
            $altText = ucfirst(str_replace('_', ' ', preg_replace('/^[0-9]+_/', '', $file->filename)));
        }

        $information = [
            'file'      => $fileName,
            'mtime'     => $file->mtime,
            'alt'       => $altText,
            'caption'   => (!empty($meta['caption']) ? $meta['caption'] : ''),
            'title'     => $title,
            'metafile'  => $meta,
            'icon'      => 'assets/contao/images/' . $file->icon,
            'extension' => $file->extension,
            'size'      => $file->filesize,
            'sizetext'  => sprintf('(%s)', Controller::getReadableSize($file->filesize, 2)),
            'url'       => StringUtil::specialchars($this->getDownloadLink($fileName))
        ];

        // Prepare GD images.
        if ($information['isGdImage'] = $file->isGdImage) {
            $information['src'] = urldecode($this->resizeImage($fileName));
            if (file_exists(TL_ROOT . '/' . $information['src'])) {
                $size              = getimagesize(TL_ROOT . '/' . $information['src']);
                $information['lb'] = 'lb' . $this->getLightboxId();
                $information['w']  = $size[0];
                $information['h']  = $size[1];
                $information['wh'] = $size[3];
            }
        }

        // Prepare SVG images.
        if ($information['isSvgImage'] = $file->isSvgImage) {
            $information['src'] = $fileName;
        }

        // Prepare the picture for provide the image size.
        if ($information['isPicture'] = (int) $this->resizeImages[2]) {
            $picture = Picture::create($file, $this->getResizeImages())->getTemplateData();

            $picture['alt']   = $altText;
            $picture['title'] = $title;

            $information['picture'] = $picture;
        }

        $this->modifiedTime[] = $file->mtime;
        $this->outputBuffer[] = $information;
    }
Process a single file.

@param string $fileName The file to fetch data for.

@return void