Won't optimize thumbnails

Permalink Browser Info Environment
Hi there,
my latest install does not seem to optimize the thumbnails.
Like on my other pages I have checked the option to optimize thumbnails in the plugin settings. Also I have run the automated job "Fill thumbnail database table" and even re-installed the plugin. However, only the original files seem to get optimized.
What else can I do to fix this?

Type: Ticket
Status: Archived
dklx
View Replies:
A3020 replied on at Permalink Reply
A3020
How do you verify that the thumbnails are not optimized? It's possible that they can't be (further) optimized.

You say original files do get optimized, could you try downloading a thumb file that hasn't been optimized, and uploading it as a new file in the File Manager? Then, if that file does gets optimized, there seems to be some kind of bug.

It might also be good to check permissions of the folders, to see whether the web service has 'write' permissions. Are you familiar with that?
dklx replied on at Permalink Reply
dklx
I was confused about the page size after using the plugin. So I checked the optimized image table and it only lists the original file.
To verify, I downloaded a thumb and ran it through the tinypng web interface where it got optimized and drastically smaller.
Now I have also tried your suggestion. I uploaded the thumb to the website again and it also got optimized through the plugin. Still only the original file though.

Are you talking about the folder permission in the file system? The folders 'files' and the subfolder 'thumbnails' have permissions set to rwxr-xr-x (0755).
I have double checked with my previous install of the plugin on a different site (running concrete5 8.5.1) on the same server and it is using the same permissions and working just fine.
A3020 replied on at Permalink Reply
A3020
Could you enable the setting "Write output to concrete5 log", to see if there are errors / warnings written to the concrete5 log after running the optimizer?
dklx replied on at Permalink Reply 1 Attachment
dklx
This is the log I get after uploading a test image and running the optimizer.
A3020 replied on at Permalink Reply
A3020
It looks to me that you have both server side optimization enabled as the TinyPNG service. Based on the error "jpegoptim command not found', I assume you don't have the server libraries installed, so you should disable server side optimization.
dklx replied on at Permalink Reply 1 Attachment
dklx
Thanks for all your quick replies and support!

That's correct. I don't have the libraries installed as I am using the tinypng service.
Please explain how to disable the server side optimization though? I didn't see an option to disable it in the settings of the plugin?
On the installation page (https://www.concrete5.org/marketplace/addons/image-optimizer/installation/) it says to "just use the TinyPNG integration by entering an API key to the Image Optimizer settings page". I assumed this would disable the server side optimization?

Also please have a look at the attached log I pulled from my other install where it is working as expected: It throws the same error about the server side optimizing command not found but still optimizes the thumbs via tinypng (in this example the file_manager_listing thumb).
A3020 replied on at Permalink Reply 1 Attachment
A3020
Thanks for the feedback! I looked into things, and discovered that the server side optimizers were also loaded if TinyPNG is configured and enabled, so I fixed that in version 3.2.10. That way you won't see those errors anymore about a 'missing command'. Could you confirm?

Regarding the thumbnails that aren't optimized; I added an additional log message in case a thumbnail type is missing. That _might_ be a reason. In order to really find out what's going on I'd need database and CMS access. For your information, in the file image_optimizer/src/ImageOptimizer/ThumbnailFileList.php, two queries are performed. The result of those queries is a list of thumbnail files that have not been processed yet. Those files will be added to the queue and should end up in the log entries.

I just tested on my own website, and thumbnails really should be included. See attachment.

Maybe you'd update to version 3.2.10 first and give that a spin?
dklx replied on at Permalink Reply
dklx
I can confirm there are no further errors about the server side optimization commands not found.
Thank you for the quick update!

Although I haven't been able to see any additional log entries about missing thumbnail types, I think I have found the problem:
I checked the queries in your ThumbnailFileList.php and it turns out all the thumbnails in my database table "FileImageThumbnailPaths" have "isBuilt" set to "0".
So when I manually change them to 1 they do get optimized through your plugin.
Still I have no solution to this and don't know why they are set to 0 while they are not on my other sites. The site works fine and the thumbnails are being created and I can use them on my site.

I was playing around a bit with the options set in the concrete5 Thumbnail Generation Strategy (synchronously or asynchronously), but I am still not sure if it has something to do with this.
I believe this a concrete5 issue then? I'd still be grateful for any ideas you have to fix this issue or for a workaround as your plugin relies on this.

Thank you so much for your awesome support so far!
A3020 replied on at Permalink Reply
A3020
Thanks for debugging. It all makes sense now ;) it's indeed C5's task to 'built' the thumbnails. Image Optimizer is waiting for that to prevent optimizing incomplete thumbs.

I'm not sure why your thumbs aren't generated. Maybe you have an 'exit' function call somewhere in the code? You'd also ask help on Slack, maybe someone is familiar with the problem. I see your c5 installation is up to date, so that can't be the problem!
eldios replied on at Permalink Reply
eldios
Hello,
thanks redirecting to this post.
Unfortunaltely I still have the problem. No "own" thumbnails are generated through the plugin (Concrete 8.5.2.1 und Image Optimizer 3.2.10).
And I do not find a solution. In the file ThumbnailFileList.php the variable isBuilt is set to 1.
Do you have ideas? Thanks for the perfect support!
dklx replied on at Permalink Reply
dklx
Hi eldios,
I have found that your own thumbnails only get written to the database table after running the job "Fill thumbnail database table".
However I still don't know why isBuilt is set to 0 on those entries even though the thumbnails are created and available.
After researching this a bit I noticed that they will get set to 1 in chunks after each concrete5 page reload. I might be wrong but it seems to me they are updated in the background by concrete5, so eventually they should all be updated and optimized.
Also some other user reported on Slack that he had to rescan his files to have isBuilt set to 1.

I don't know why it works like this. I think these entries should be added to the database table with isBuilt set to 1 as soon as they are successfully created. I hope there will be a more reliable solution to this in the next version.
eldios replied on at Permalink Reply
eldios
Hey, dklx!

Thank you very much for your answer!
Ok, so I have to click first „Fill thumbnail database table“ and than I am able to generate the thumbnails! I tested it out and it worked, but this is not a good solution.
You said, you tested it on another installation, there it worked. Which version of concretet5 did you use? Does @A3020 work on a solution?

Thank you!
dklx replied on at Permalink Reply
dklx
Hi eldios,
well, on my new installation it works this way. On my previous install it wouldn't work at all. Both were using version 8.5.2.
The way I understand it is that this is a concrete5 issue and is not caused by A3020's optimizer plugin. The plugin simply relies on these database entries which unfortunately are not reliably set by concrete5.
I don't have a good fix for this yet.
The only solution I see for now is to set up cron jobs that run the concrete5 jobs "Fill thumbnail database table" and the Image Optimizer.
eldios replied on at Permalink Reply
eldios
Hi dklx!

Thank you for your fast answer and the information!
Ok, I see, but this do not always work, sometimes I have to click two times on the automated job „fill Thumbnail database table!
Really wired!
I hope concrete5 will have asap a solution! If you have further information please be so kind and contact me again!
Many many thanks
ConcreteCMS replied on at Permalink Reply
ConcreteCMS
Attention: Since there has been no activity on this issue for two weeks, this issue has been automatically archived.

To re-open this issue, reply to this message.

concrete5 Environment Information

# concrete5 Version
Core Version - 8.5.2
Version Installed - 8.5.2
Database Version - 20190925072210

# concrete5 Packages
Image Optimizer (3.2.9), List files from set (1.0.13)


# PHP Version
7.2.27

Browser User-Agent String

Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You may not request a refund that is not currently owned by you.