Git Product home page Git Product logo

sourcebroker / imageopt Goto Github PK

View Code? Open in Web Editor NEW
31.0 5.0 8.0 2.43 MB

TYPO3 extension imageopt. Optimize images resized by TYPO3 so they will take less space, page will be downloaded faster and Google PageSpeed Insights score will get higher.

License: Other

PHP 94.28% Dockerfile 0.83% Shell 4.52% HTML 0.37%
typo3-extension image-optimization typo3-cms-extension google-pagespeed-insights jpegoptim jpegtran optipng mozjpeg kraken imageoptim

imageopt's People

Contributors

famouswolf avatar frans-beech-it avatar kamilmaliszewski avatar kszymukowicz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

imageopt's Issues

V12 - Compatibility

Hi, is there any plans for V12 Compatibility or are there alternatives to consider?

[FEATURE] Make persisting of $optimizationResult optional

Now the optimization result are always persisted. For bigger sites that means you get a table with a lot of records (> 1.000.000) that are mainly there for debug reasons.

Would it be possible to maken $this->objectManager->get(OptimizationResultRepository::class)->add($optimizationResult); optional?

Best Result is not taken

I found a problem if the second iteration result gets the same bytes as the original image.

Look here:

if ((filesize($theBestOptimizedImage) === 0 && $fileSizeBeforeOptimization >= filesize($providerOptimizationResult['optimizedFileAbsPath']))
|| (filesize($providerOptimizationResult['optimizedFileAbsPath']) < filesize($theBestOptimizedImage))

The first condition mets in this case, because the
$theBestOptimizedImage is the empty tempfile defined in
$theBestOptimizedImage = $this->createTempFile();

$theBestOptimizedImage = $this->createTempFile();

Temporary files aren't deleted

TYPO3 version: 10.4.28
imageopt version: 6.0.0

When using composer temporary files are saved in /var/transient/. The function to remove temporary files (SourceBroker\Imageopt\Utility\TemporaryFileUtility::unlinkTempFiles) has the path hardcoded as Environment::getPublicPath() . 'typo3temp/var/transient/'. This means the files aren't deleted at all.

Overwrite FileProcessingService break generation of preview images from online media like youtube

If you add an Youtube Video with the File-Module, the Generation of the Preview Image is broken and no Preview-Image is created.

FIX:

There is a Part missing on top in the method FileProcessingService for TYPO3 8.7 and 9.5.

    public function processFile(
        Resource\FileInterface $fileObject,
        Resource\ResourceStorage $targetStorage,
        $taskType,
        $configuration
    ) {
        // Enforce default configuration for preview processing here,
        // to be sure we find already processed files below,
        // which we wouldn't if we would change the configuration later, as configuration is part of the lookup.
        if ($taskType === Resource\ProcessedFile::CONTEXT_IMAGEPREVIEW) {
            $configuration = Resource\Processing\LocalPreviewHelper::preProcessConfiguration($configuration);
        }

kind regards
gregor

Errors when processed file is missing

The scheduler task throws an error when a processed file is missing. This should probably just be ignored since the processed file record is deleted anyways?

$processedFal->delete();

missing-processed-file

I also get this error in the CliDisplayUtility which stops the execution of the command

[ ErrorReporting\Warning ]       
 Warning: Undefined array key ""

The errors happen in TYPO3 11.5.26 with PHP 8.1 with MySQL 8.0

Missing array key breaks processing - probably missing processed file

I'm not really sure what is happening there, but it's likely that some processed files are not generated properly on one of my systems. So there are quite some processed files missing that already caused me some troubles in the past and i have not found the cause for it...

Thus when the imageopt:optimizefalprocessedimages task runs, it breaks with this message. Sometimes right after executing the task, sometimes after it processed some files.

image
{
   "message": "Task threw an error: TYPO3\\CMS\\Scheduler\\Task\\ExecuteSchedulableCommandTask' (UID: 33). Was started at 2023-07-26 16:00:00. Error: a:5:{s:4:\"code\";i:1;s:7:\"message\";s:31:\"Warning: Undefined array key \"\"\";s:4:\"file\";s:88:\"\/var\/www\/www.example.org\/private\/typo3conf\/ext\/imageopt\/Classes\/Utility\/CliDisplayUtility.php\";s:4:\"line\";i:101;s:11:\"traceString\";s:2245:\"#0 \/var\/www\/www.example.org\/private\/typo3conf\/ext\/imageopt\/Classes\/Command\/OptimizeFalProcessedImages.php(80): SourceBroker\\Imageopt\\Utility\\CliDisplayUtility::displayOptionResult()\n#1 \/var\/www\/www.example.org\/vendor\/symfony\/console\/Command\/Command.php(298): SourceBroker\\Imageopt\\Command\\OptimizeFalProcessedImages->execute()\n#2 \/var\/www\/www.example.org\/private\/typo3\/sysext\/scheduler\/Classes\/Task\/ExecuteSchedulableCommandTask.php(106): Symfony\\Component\\Console\\Command\\Command->run()\n#3 \/var\/www\/www.example.org\/private\/typo3\/sysext\/scheduler\/Classes\/Scheduler.php(192): TYPO3\\CMS\\Scheduler\\Task\\ExecuteSchedulableCommandTask->execute()\n#4 \/var\/www\/www.example.org\/private\/typo3\/sysext\/scheduler\/Classes\/Command\/SchedulerCommand.php(255): TYPO3\\CMS\\Scheduler\\Scheduler->executeTask()\n#5 \/var\/www\/www.example.org\/private\/typo3\/sysext\/scheduler\/Classes\/Command\/SchedulerCommand.php(194): TYPO3\\CMS\\Scheduler\\Command\\SchedulerCommand->executeOrStopTask()\n#6 \/var\/www\/www.example.org\/private\/typo3\/sysext\/scheduler\/Classes\/Command\/SchedulerCommand.php(120): TYPO3\\CMS\\Scheduler\\Command\\SchedulerCommand->loopTasks()\n#7 \/var\/www\/www.example.org\/vendor\/symfony\/console\/Command\/Command.php(298): TYPO3\\CMS\\Scheduler\\Command\\SchedulerCommand->execute()\n#8 \/var\/www\/www.example.org\/vendor\/symfony\/console\/Application.php(1040): Symfony\\Component\\Console\\Command\\Command->run()\n#9 \/var\/www\/www.example.org\/vendor\/helhum\/typo3-console\/Classes\/Console\/Mvc\/Cli\/Symfony\/Application.php(189): Symfony\\Component\\Console\\Application->doRunCommand()\n#10 \/var\/www\/www.example.org\/vendor\/symfony\/console\/Application.php(301): Helhum\\Typo3Console\\Mvc\\Cli\\Symfony\\Application->doRunCommand()\n#11 \/var\/www\/www.example.org\/vendor\/symfony\/console\/Application.php(171): Symfony\\Component\\Console\\Application->doRun()\n#12 \/var\/www\/www.example.org\/vendor\/helhum\/typo3-console\/Classes\/Console\/Core\/Kernel.php(118): Symfony\\Component\\Console\\Application->run()\n#13 \/var\/www\/www.example.org\/vendor\/helhum\/typo3-console\/Scripts\/typo3-console.php(18): Helhum\\Typo3Console\\Core\\Kernel->handle()\n#14 \/var\/www\/www.example.org\/vendor\/helhum\/typo3-console\/Scripts\/typo3-console.php(20): {closure}()\n#15 \/var\/www\/www.example.org\/vendor\/helhum\/typo3-console\/typo3cms(3): require('...')\n#16 \/var\/www\/www.example.org\/vendor\/bin\/typo3cms(107): include('...')\n#17 {main}\";} ",
   "time": "26.07.2023 16:00",
   "task": "O:54:\"TYPO3\\CMS\\Scheduler\\Task\\ExecuteSchedulableCommandTask\":14:{s:12:\"\u0000*\u0000scheduler\";N;s:10:\"\u0000*\u0000taskUid\";i:33;s:11:\"\u0000*\u0000disabled\";b:0;s:19:\"\u0000*\u0000runOnNextCronJob\";b:0;s:12:\"\u0000*\u0000execution\";O:29:\"TYPO3\\CMS\\Scheduler\\Execution\":6:{s:8:\"\u0000*\u0000start\";i:1686562144;s:6:\"\u0000*\u0000end\";s:1:\"0\";s:11:\"\u0000*\u0000interval\";i:0;s:11:\"\u0000*\u0000multiple\";s:1:\"0\";s:10:\"\u0000*\u0000cronCmd\";s:11:\"0 *\/1 * * *\";s:23:\"\u0000*\u0000isNewSingleExecution\";b:0;}s:16:\"\u0000*\u0000executionTime\";i:1690380000;s:14:\"\u0000*\u0000description\";s:0:\"\";s:12:\"\u0000*\u0000taskGroup\";i:0;s:9:\"\u0000*\u0000logger\";N;s:20:\"\u0000*\u0000commandIdentifier\";s:35:\"imageopt:optimizefalprocessedimages\";s:12:\"\u0000*\u0000arguments\";a:0:{}s:10:\"\u0000*\u0000options\";a:2:{s:23:\"numberOfImagesToProcess\";b:1;s:19:\"rootPageForTsConfig\";b:0;}s:15:\"\u0000*\u0000optionValues\";a:2:{s:23:\"numberOfImagesToProcess\";s:3:\"100\";s:19:\"rootPageForTsConfig\";s:0:\"\";}s:11:\"\u0000*\u0000defaults\";a:2:{s:23:\"numberOfImagesToProcess\";N;s:19:\"rootPageForTsConfig\";N;}}"
}

failed on delete images

hey there,
i tried your ext to imageoptimization. Installation was easy. But if i run the optimization task, i always geht this error:

Execution of task "Extbase CommandController Task (extbase)" failed with the following message: PHP Warning: unlink(fileadmin/processed/c/b/csm_slider-stadtentwicklung_dd09009e70.jpg): No such file or directory in /homepages/28/d574274134/htdocs/update7/typo3conf/ext/imageopt/Classes/Service/ImageManipulationService.php line 220

but the files are really there! Do you have a hint for this problem?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.