News:

Support the VirtueMart project and become a member

Main Menu

VM Bugs Report in thumbnail generation [v3.8.4 10335]

Started by EvanGR, September 29, 2020, 11:45:47 AM

Previous topic - Next topic

EvanGR

[Update with the bug reports after more research...]

There are bugs in the way VM handles on-demand thumb generation in the template.

e.g. if I do:

$product->images[0]->displayMediaThumb('', false, "", false, false, false, 0, 320);
The new thumbnail file will not be generated, unless the original thumbnail is removed first!
And if I remove the original thumbnail, the new one generated will be called product-image_0x320.jpg.

If I do $product->images[0]->displayMediaThumb('', false); to just recreate the original thumb, using the original filename, nothing is created.

Also, if I do print_r($product->images[0]);

I get a discrepancy in the object data...

[file_url_thumb] => images/products/resized/mylovelyproducts/product-image.jpg
[file_name_thumb] => product-image_0x320


Notice the thumb filename is different, than the one in file url!

Finally, if I do $product->images[0]->getFileUrlThumb() or something like $product->images[0]->getFileUrlThumb(0, 320)

I always get product-image.jpg as a result, no matter the thumbnail sizes I created before, or if the original thumbnail exists or not.
In other words, I get a non-valid filename.



---- ORIGINAL POST BELOW ---
Hello,

Some of our product thumbnails, are of lower dimensions that we would like. So, I am trying to force-recreate the thumbnails for products, in the category view.
I tried this:
$product->images[0]->displayMediaThumb('', false);
and this:
$product->images[0]->displayMediaThumb('', false, "", false, true, false, 0, 280);

The front page still shows the previous low-quality thumbnail.
We use this to get the thumbnail: $product->images[0]->getFileUrlThumb();

Notes:

  • We want to gradually recreate all thumbs to the correct size, during page views.
  • We want to force-overwrite the previous thumbs, if possible.
  • We cannot use VM's Reset Thumbs function, because it is global, there are thousands of products, and should any problem occur, it may take us many hours to fix.


Any ideas? Thanks

J3.9.21/VM3.8.4 10335

jenkinhill

I have reset the thumb size of a couple of sites. All I did was to set the new Thumbnail Image Height in configuration then simply delete the thumbs. They were regenerated at the correct size when the category pages were viewed.  Alternatively rename the thumbs directory so you still keep the old thumbs.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

EvanGR

#2
Thanks. Not that simple... many products have been batch imported with CSVi, and the thumbnails are not in the default folder.

EDIT2: After more testing, found the bugs in VM

I updated the first post.