[TH] Image Optimizer [Deleted]

Status code 127 is normally returned by your shell when any given command within your script is not found in any of the paths defined by PATH system environment variable.
 
Gifsicle doesn't seem to be working. jpg's are good. any ideas? error doesn't say much.

Server error log
  • ErrorException: [Image Optimizer] Error received for status ID 250: Gifsicle failed with code 1
  • src/XF/Error.php:75
  • Generated by: xxxxxx
  • Apr 23, 2020 at 12:11 PM
Stack trace
#0 src/XF.php(184): XF\Error->logError('[Image Optimize...', false)
#1 src/addons/ThemeHouse/ImageOptimizer/ImageOptimizer/Traits/ExecutableProviderTrait.php(37): XF::logError('[Image Optimize...')
#2 src/addons/ThemeHouse/ImageOptimizer/Service/ImageOptimizer/Optimize.php(61): ThemeHouse\ImageOptimizer\ImageOptimizer\Gifsicle->optimizeImage(Object(ThemeHouse\ImageOptimizer\Service\ImageOptimizer\Optimize))
#3 src/addons/ThemeHouse/ImageOptimizer/ContentHandler/AbstractHandler.php(211): ThemeHouse\ImageOptimizer\Service\ImageOptimizer\Optimize->run()
#4 src/addons/ThemeHouse/ImageOptimizer/ContentHandler/AbstractHandler.php(140): ThemeHouse\ImageOptimizer\ContentHandler\AbstractHandler->optimize(Object(ThemeHouse\ImageOptimizer\Entity\Status))
#5 src/addons/ThemeHouse/ImageOptimizer/ImageOptimizer.php(123): ThemeHouse\ImageOptimizer\ContentHandler\AbstractHandler->createStatusAndOptimize(Object(ThemeHouse\ImageOptimizer\XF\Entity\ImageProxy))
#6 src/addons/ThemeHouse/ImageOptimizer/ImageOptimizer.php(214): ThemeHouse\ImageOptimizer\ImageOptimizer->optimizeEntity('th_imageopt_ima...', Object(ThemeHouse\ImageOptimizer\XF\Entity\ImageProxy))
#7 src/addons/ThemeHouse/ImageOptimizer/ImageOptimizer.php(198): ThemeHouse\ImageOptimizer\ImageOptimizer->optimizeEntities('th_imageopt_ima...', Object(XF\Mvc\Entity\ArrayCollection))
#8 src/addons/ThemeHouse/ImageOptimizer/Job/ImageOptimizer.php(67): ThemeHouse\ImageOptimizer\ImageOptimizer->optimizeRange('th_imageopt_ima...', 28558, '5')
#9 src/XF/Job/Manager.php(253): ThemeHouse\ImageOptimizer\Job\ImageOptimizer->run(G)
#10 src/XF/Job/Manager.php(195): XF\Job\Manager->runJobInternal(Array, G)
#11 src/XF/Job/Manager.php(111): XF\Job\Manager->runJobEntry(Array, G)
#12 src/XF/Admin/Controller/Tools.php(120): XF\Job\Manager->runByIds(Array, 8)
#13 src/XF/Mvc/Dispatcher.php(350): XF\Admin\Controller\Tools->actionRunJob(Object(XF\Mvc\ParameterBag))
#14 src/XF/Mvc/Dispatcher.php(257): XF\Mvc\Dispatcher->dispatchClass('XF:Tools', 'RunJob', Object(XF\Mvc\RouteMatch), Object(XF\Admin\Controller\Tools), NULL)
#15 src/XF/Mvc/Dispatcher.php(113): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Admin\Controller\Tools), NULL)
#16 src/XF/Mvc/Dispatcher.php(55): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#17 src/XF/App.php(2184): XF\Mvc\Dispatcher->run()
#18 src/XF.php(391): XF\App->run()
#19 admin.php(13): XF::runApp('XF\\Admin\\App')
#20 {main}
Request state
array(4) {
["url"] => string(24) "/admin.php?tools/run-job"
["referrer"] => string(45) "xxxx.com/admin.php?tools/run-job"
["_GET"] => array(1) {
["tools/run-job"] => string(0) ""
}
["_POST"] => array(3) {
["_xfRedirect"] => string(55) "xxxx.com/admin.php?tools/rebuild&success=1"
["_xfToken"] => string(8) "********"
["only_ids"] => string(3) "274"
}
}
 
Exit code 1 generally just means an error happened (in this context that means an error while gifsicle tried to convert an image). You'll have to check with the gifiscle devs if that's an issue on their end, with the image or your setup/usage.
 
Thanks, it seems like it's old avatars that seem to be throwing the issue. perhaps vb days format allowed it in? not sure.


Another question - how do i rebuild/optimize the xmfg images? there's no rebuild option for that.
 
Thanks, it seems like it's old avatars that seem to be throwing the issue. perhaps vb days format allowed it in? not sure.
Impossible to tell from here unfortunately. Unless it's an ongoing issue, I would recommend to just ignore it though. It should just use the unoptimized version in that case.


Another question - how do i rebuild/optimize the xmfg images? there's no rebuild option for that.
I don't recall the exact available rebuild options right now, but the media gallery under the hood just stores media as attachments, so the rebuild job for attachments will include any media from the media gallery.
 
OK, there is this problem with this add-on: I start manual optimization via Tools. The process crashes once in a while but when I start the process again, it starts from scratch! There are 400.000 images on the web site! Think about big boards please!
 
Stuck at one point:

Code:
An exception occurred: [XF\Db\Exception] MySQL statement prepare error [2006]: MySQL server has gone away in src/XF/Db/AbstractStatement.php on line 228

XF\Db\AbstractStatement->getException() in src/XF/Db/Mysqli/Statement.php at line 196
XF\Db\Mysqli\Statement->getException() in src/XF/Db/Mysqli/Statement.php at line 39
XF\Db\Mysqli\Statement->prepare() in src/XF/Db/Mysqli/Statement.php at line 54
XF\Db\Mysqli\Statement->execute() in src/XF/Db/AbstractAdapter.php at line 94
XF\Db\AbstractAdapter->query() in src/XF/Mvc/Entity/Finder.php at line 1261
XF\Mvc\Entity\Finder->fetchOne() in src/XF/Repository/UpgradeCheck.php at line 39
XF\Repository\UpgradeCheck->getLatestUpgradeCheck() in src/XF/Admin/App.php at line 238
XF\Admin\App->renderPageHtml() in src/XF/App.php at line 1995
XF\App->renderPage() in src/XF/Admin/App.php at line 122
XF\Admin\App->renderPage() in src/XF/Mvc/Dispatcher.php at line 402
XF\Mvc\Dispatcher->render() in src/XF/Mvc/Dispatcher.php at line 58
XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2184
XF\App->run() in src/XF.php at line 391
XF::runApp() in admin.php at line 13
 
goneaway errors are usually do to a wait_timeout setting in my.cnf that isn't high enough to process the request. really has nothing to do with this utility.
 
How can we enable webp for kraken?
looking at the api, it seems simple to add:

I tried hardcoded it in, but it broke the whole script :X

Kraken.php

Code:
  $params = [

            'file' => $tempImage,

            'wait' => true,
           
        ];

Code:
  $params = [

            'file' => $tempImage,

            'wait' => true,

            'webp' = true,
           
        ];

didn't work for some reason.
 
Last edited:
How can we enable webp for kraken?
looking at the api, it seems simple to add:

I tried hardcoded it in, but it broke the whole script :X

Kraken.php

Code:
  $params = [

            'file' => $tempImage,

            'wait' => true,
          
        ];

Code:
  $params = [

            'file' => $tempImage,

            'wait' => true,

            'webp' = true,
          
        ];

didn't work for some reason.
I'll check with one of our developers on this :)

Is there any reason this wouldn't work with Attachment Improvements?
No issues have been reported recently, @Joe Link. So I'd say you'd be safe to use it with that add-on.
 
Did you run that rebuild with the CLI or through the browser? If you do it through the browser it should remove them every time it reloads the page to run the next batch, if you do it with CLI it may have a different behavior though - will have to check into it. Definitely should be safe to delete those, but I'd recommend taking a backup of that directory just in case. Nothing should be referencing anything in that directory directly, but best to be safe and download a zip of them before permanently deleting :)

Did this ever get resolved and/or answered? I'm processing my attachments through the CLI and noticing the same behavior.
 
I can't seem to find any other posts about this - has anyone else had issues with avatars re-positioning themselves from where the user had cropped them using the editor?
 
Top Bottom