Keyword
Please note that official support for commercial extensions & templates is provided in the Subscriber Help Desk.
Support requests should ONLY be directed there and require an active subscription plan.
This forum board is to be used for archive purposes and knowledge exchange ONLY.

Defining thumbnails in one content item affects them in all during cache time.

  • joomar
  • joomar's Avatar Topic Author
  • Offline
  • New Member
More
16 years 9 months ago - 16 years 9 months ago #12341 by joomar
Hi guys,

If you include the same gallery (pictures from the same folder) in various content items, EVERY content item will show the thumbnails in the size from the last gallery, that was cached.

Example:
Let's say in the mambot parameters we specified the image thumbnail width as 80 and in our layout that creates 4 columns of thumbnails.

Then in content item A the following line creates the thumbnails in 4 columns:
{gallery}slideshow_xy{/gallery}

And in content item B the following line creates the thumbnails in 3 columns:
{gallery}slideshow_xy:120{/gallery}

Let's suppose we set the thumbnail cache time to 10 minutes.

What happens next is a problem:
- Say we visit content item A, then the thumbnails are created with a width of 80 pixels. And they are correctly displayed in content item A in 4 columns.
- In the next minute we visit content item B. The thumbnails should be 120 pixels wide and 3 columns. But what we see is all thumbnails are still 80 pixels wide. However they are arranged in 3 columns, since the width is calculated correctly set via CSS (my guess).
Reason: The still cached images from earlier have a different size than specified here.

- After ten minutes if we reload content item B, the thumbnails will be 120 wide.
- But if we visit immediately after that content item A, then the thumbnails there are arranged in 4 columns, as expected, but 120 pixels wide instead of 80. That crams the images in the columns and creates clipping.

The reason for this behaviour is, that in plugin_jw_sigpro.php in various lines the filename for the cached file is build only from two identifying characteristics, that stay the same in every content item:
md5($_images_dir_.$name).".".$format

This behaviour can be resolved, or at least improved so the thumbnails can be defined for every content item individually, if you include the content item id in the cached thumbs' filenames:
$row->id.md5($_images_dir_.$name).".".$format

or probably also
md5($row->id.$_images_dir_.$name).".".$format


It would be good to include this in the next release.
Do you agree?

Please Log in or Create an account to join the conversation.

  • JoomlaWorks Support Team
  • JoomlaWorks Support Team's Avatar
  • Offline
  • Platinum Member
More
16 years 9 months ago #12342 by JoomlaWorks Support Team
Hi my friend!

This is really smart notice!

It's a good hack and probably will include it to the next version!
Probably I'll use the "width" (if exist) as third parameter for the cached name!

Thank you!

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • joomar
  • joomar's Avatar Topic Author
  • Offline
  • New Member
More
16 years 9 months ago #12343 by joomar
no problem.

The width is probably a smart choice to include.

However I currently have altered it to:
$row->id."_".md5($_images_dir_.$name).".".$format

That way it is very easy to track a problem with slideshow, since all thumbnails of one gallery (per content item) are grouped together in the cache dir.
Notice: that I leave the $row->id unencoded (outside of the md5()), so I can easily find them in the directory.

Maybe you can incorporate both, id and width, while id should be a clear readable prefix as shown above.

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum