Image Optimizer for XF 2.0

Image Optimizer for XF 2.0 [Paid] 2.1.8

No permission to buy ($29.00)
Does this optimize the avatars or other images that isn't attachments?
Currently it is support Attachments and Image Proxy only. Avatars have been resized and save low quality so i dont think it is need to compress again.
 
Hi @truonglv, does this addon resize the cached proxy images to predefined maximum physical dimensions (pixels), or to ones set in the ACP -> Options -> Attachments: Maximum Attachment Image Dimensions?
 
  • Like
Reactions: HJW
truonglv, thank you for your reply. I hope you will add that function to the addon in the future, as the cached images eat up my HDD's very fast.
 
  • Like
Reactions: HJW
I think it seems like the only problem is that it does not work with XenForo Media Gallery. In this case, the system optimizing has stopped working, attachment_data (#18115) since Friday. I really don't know what happened. Previously, I had thought that XenForo Media Gallery add-on is compatible with the XenForo default attachment system. Isn't that so? Who knows, perhaps, I could be wrong about that.
 
I think it seems like the only problem is that it does not work with XenForo Media Gallery. In this case, the system optimizing has stopped working, attachment_data (#18115) since Friday. I really don't know what happened. Previously, I had thought that XenForo Media Gallery add-on is compatible with the XenForo default attachment system. Isn't that so? Who knows, perhaps, I could be wrong about that.
Does you see any error in sever error logs page?
 
Nope. There are no errors in the server error logs page.
 

Attachments

  • 20181111132701.webp
    20181111132701.webp
    53.2 KB · Views: 49
  • 20181111133454.webp
    20181111133454.webp
    2.6 KB · Views: 49
  • 20181111133528.webp
    20181111133528.webp
    7.8 KB · Views: 46
Does this addon work for conversations and media gallery as well? Or is it just for forum posts/replies?

I love the addon thank you! Would love to see it work for media gallery images too.

I just tried the avatar feature and ran into issue:
Code:
League\Flysystem\FileNotFoundException: Job Truonglv\ImageOptimizer\Job\Optimizer: File not found at path: avatars/h/1/1024.jpg src/vendor/league/flysystem/src/Filesystem.php:385
Generated by: Unknown account Nov 11, 2018 at 6:15 PM
Stack trace
#0 src/vendor/league/flysystem/src/Filesystem.php(193): League\Flysystem\Filesystem->assertPresent('avatars/h/1/102...')
#1 [internal function]: League\Flysystem\Filesystem->readStream('avatars/h/1/102...', Array)
#2 src/vendor/league/flysystem-eventable-filesystem/src/EventableFilesystem.php(431): call_user_func_array('parent::readStr...', Array)
#3 src/vendor/league/flysystem-eventable-filesystem/src/EventableFilesystem.php(395): League\Flysystem\EventableFilesystem\EventableFilesystem->callFilesystemMethod('readStream', Array)
#4 src/vendor/league/flysystem-eventable-filesystem/src/EventableFilesystem.php(154): League\Flysystem\EventableFilesystem\EventableFilesystem->delegateMethodCall('readStream', Array)
#5 [internal function]: League\Flysystem\EventableFilesystem\EventableFilesystem->readStream('avatars/h/1/102...')
#6 src/vendor/league/flysystem/src/MountManager.php(269): call_user_func_array(Array, Array)
#7 src/vendor/league/flysystem/src/MountManager.php(179): League\Flysystem\MountManager->invokePluginOnFilesystem('readStream', Array, 'data')
#8 src/XF/Util/File.php(91): League\Flysystem\MountManager->__call('readStream', Array)
#9 src/addons/Truonglv/ImageOptimizer/Job/Optimizer.php(106): XF\Util\File::copyAbstractedPathToTempFile('data://avatars/...')
#10 src/addons/Truonglv/ImageOptimizer/Job/Optimizer.php(69): Truonglv\ImageOptimizer\Job\Optimizer->optimizeImageFile('data://avatars/...')
#11 src/XF/Job/Manager.php(241): Truonglv\ImageOptimizer\Job\Optimizer->run(8)
#12 src/XF/Job/Manager.php(187): XF\Job\Manager->runJobInternal(Array, 8)
#13 src/XF/Job/Manager.php(76): XF\Job\Manager->runJobEntry(Array, 8)
#14 job.php(14): XF\Job\Manager->runQueue(false, 8)
#15 {main}

It is looking for avatar image in h directory. There are very few avatars in that directory. I have these directories under avatar:
  • h
  • l
  • m
  • o
  • s
With the following sizes:
1.7M h
4.0K index.html
42M l
21M m
36M o
16M s

The number of images in each directory:
  • h - 17
  • o - 2272
  • l - 3190
  • m - 3187
  • s - 3187
It looks like the o directory was created when I imported the forum to XF2 and has what I assume is 'original' avatar images.
 
I love the addon thank you! Would love to see it work for media gallery images too.

I just tried the avatar feature and ran into issue:
Code:
League\Flysystem\FileNotFoundException: Job Truonglv\ImageOptimizer\Job\Optimizer: File not found at path: avatars/h/1/1024.jpg src/vendor/league/flysystem/src/Filesystem.php:385
Generated by: Unknown account Nov 11, 2018 at 6:15 PM
Stack trace
#0 src/vendor/league/flysystem/src/Filesystem.php(193): League\Flysystem\Filesystem->assertPresent('avatars/h/1/102...')
#1 [internal function]: League\Flysystem\Filesystem->readStream('avatars/h/1/102...', Array)
#2 src/vendor/league/flysystem-eventable-filesystem/src/EventableFilesystem.php(431): call_user_func_array('parent::readStr...', Array)
#3 src/vendor/league/flysystem-eventable-filesystem/src/EventableFilesystem.php(395): League\Flysystem\EventableFilesystem\EventableFilesystem->callFilesystemMethod('readStream', Array)
#4 src/vendor/league/flysystem-eventable-filesystem/src/EventableFilesystem.php(154): League\Flysystem\EventableFilesystem\EventableFilesystem->delegateMethodCall('readStream', Array)
#5 [internal function]: League\Flysystem\EventableFilesystem\EventableFilesystem->readStream('avatars/h/1/102...')
#6 src/vendor/league/flysystem/src/MountManager.php(269): call_user_func_array(Array, Array)
#7 src/vendor/league/flysystem/src/MountManager.php(179): League\Flysystem\MountManager->invokePluginOnFilesystem('readStream', Array, 'data')
#8 src/XF/Util/File.php(91): League\Flysystem\MountManager->__call('readStream', Array)
#9 src/addons/Truonglv/ImageOptimizer/Job/Optimizer.php(106): XF\Util\File::copyAbstractedPathToTempFile('data://avatars/...')
#10 src/addons/Truonglv/ImageOptimizer/Job/Optimizer.php(69): Truonglv\ImageOptimizer\Job\Optimizer->optimizeImageFile('data://avatars/...')
#11 src/XF/Job/Manager.php(241): Truonglv\ImageOptimizer\Job\Optimizer->run(8)
#12 src/XF/Job/Manager.php(187): XF\Job\Manager->runJobInternal(Array, 8)
#13 src/XF/Job/Manager.php(76): XF\Job\Manager->runJobEntry(Array, 8)
#14 job.php(14): XF\Job\Manager->runQueue(false, 8)
#15 {main}

It is looking for avatar image in h directory. There are very few avatars in that directory. I have these directories under avatar:
  • h
  • l
  • m
  • o
  • s
With the following sizes:
1.7M h
4.0K index.html
42M l
21M m
36M o
16M s

The number of images in each directory:
  • h - 17
  • o - 2272
  • l - 3190
  • m - 3187
  • s - 3187
It looks like the o directory was created when I imported the forum to XF2 and has what I assume is 'original' avatar images.
Do you have custom avatar sizes? As I see the number of images it is does not matched so you could receive some errors about it.
 
@David G, if you upgraded from XF 1.5, that is normal. Because there was no two folder H and O, but new folders (H and O) are created and added to avatars folder while upgrade 1.5 to 2.0 but sometimes without upload or move new avatar. Anyway. I've solved that problem. Once that happens, follow the steps below to solve the problem but don't forget to make a backup.

1- Download H folder from avatars.
2- Download L folder from avatars.
3- Upload L folder to H folder (overwrite the existing files).
4- Upload H folder(old) to H folder (overwrite the existing files and don't worry, the old created files are protected).

Please note that you have to change all files (x.jpg) to 666, and you have to change all folders (avatars: m, s, l, h, etc.) to 777 permission. So, I mean, all image files should be 666, and all folders should be 777, and now try it again.

Edit: if the problem still exists, now remember O folder, and try the same thing but use L folder. I mean, you could use L folder to do this again.

Edit 2: @truonglv as you can see, if there are no folders, or if a file is deleted, the bypass function solves this issue. So, I mean, you can add a bypass function to skip a deleted file (ID) and folder (X).
 
Last edited:
Edit 2: @truonglv as you can see, if there are no folders, or if a file is deleted, the bypass function solves this issue. So, I mean, you can add a bypass function to skip a deleted file (ID) and folder (X).
There the non-existing images was not processed. Just log into error to let forum owner know and resolve it ;)
 
Thanks moving the files from o into h fixed the image not found.

187708

@truonglv thanks for the addon, does a fantastic job. Are you planning on implementing for media gallery attachments?
 
I am using this addon for XF1 and planning up upgrade XF1 to XF2.

Can I upgrade XF1 to XF2 without uninstalling the XF1 version of this addon and then upgrade in place to the XF2 version of this addon?
 
So just to be clear, will this help with my server disc space which is extremely large, mostly with attachments? Will it convert existing attachments and what does it do with ones being uploaded once the add on is installed and running. Ad will it effect image quality? Thanks in advance.
 
Top Bottom