VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: marvays on April 10, 2021, 07:27:28 AM

Title: New idea for better optimization of image previews
Post by: marvays on April 10, 2021, 07:27:28 AM
In the VM settings, I choose an image preview size that is good for previewing a product or category. But it's not such a good solution for the manufacturer's logo. In my e-shops, I usually have the size of the preview of product images 350px, category 350px, but the size of the manufacturer's logo is 100px.

When I want to optimize the logo and create a perfect compressed image with a size of 100pc, the VM forcibly enlarges it to 350px according to the VM settings. And all optimization is in ****.

I suggest modifying the VM so that the administrator can set the thumbnail sizes as needed according to his template for each type separately. Separately for the product, separately for the category and separately for the manufacturer.
Title: Re: New idea for better optimization of image previews
Post by: Studio 42 on April 10, 2021, 12:59:35 PM
You can modify the size in the front layout files
Search for displayMediaThumb
For eg. In file /components/com_virtuemart/views/manufacturer/tmpl/default.php
$manufacturer->images[0]->displayMediaThumb("",false);
replace with
displayMediaThumb("",false,"",rue, false,false,100,100);
to restrict the size to 100X100px
Of course, it's better to copy the file in your template overrides
Title: Re: New idea for better optimization of image previews
Post by: marvays on April 11, 2021, 18:16:43 PM
Yes, but images are 350px  . . . I only resized images via css to 100px, but page load all images 350px big.
Title: Re: New idea for better optimization of image previews
Post by: Jörgen on April 11, 2021, 18:39:34 PM
????

Jörgen
Title: Re: New idea for better optimization of image previews
Post by: pinochico on April 11, 2021, 18:44:28 PM
It's normal, if you don't change php as write Patrick.
Title: Re: New idea for better optimization of image previews
Post by: GJC Web Design on April 11, 2021, 22:15:35 PM
The solution is obvious ..  make the logo 350px by adding some whitespace to the image canvas
Title: Re: New idea for better optimization of image previews
Post by: pinochico on April 11, 2021, 23:52:18 PM
The solution is obvious for developers, yes.

But for SEO is best create small size, then 100x100px is ok.
However, they must be able to set up and use the function correctly to create a preview from the original size. (as wrote Patrick).
Title: Re: New idea for better optimization of image previews
Post by: GJC Web Design on April 12, 2021, 10:11:13 AM
It isn't obvious to me what he his asking?  Is he showing the manu logo along with the product or is he discussing the manu page with a displayed logo @ 100px?

if so then yes .. he has to do as Patrick described
Title: Re: New idea for better optimization of image previews
Post by: pinochico on April 12, 2021, 10:50:49 AM
Quotehe discussing the manu page with a displayed logo @ 100px?

Yes, he want the logo manufacturer in size 100x100px, not in size from defult size 350px (without setup in admin).
Title: Re: New idea for better optimization of image previews
Post by: marvays on April 12, 2021, 11:52:06 AM
In the administration I can enter "Thumbnail Image Width" and Thumbnail Image Height.

For perfect SEO I would like to be able to set up separately:
- Thumbnail category Image Width
- Thumbnail product Image Width
- Thumbnail Manufacturer logo Image Width
- and maybe something like Thumbnail categories Images Width

I'm adding samples from the web, where I have a different size for each type of image. But I only have one size saved on ftp. Here from the VM settings.

I would achieve that I will have different image previews depending on how I have set it up in the template. So if I have set the manufacturer's logo to 80px, the VM will produce a preview of 80px and save it on ftp. The template will then display this image and may not shrink it. This will make it faster.

However, it achieves far better results with category and product images. Yes, I can edit the manufacturer's logos manually and upload to ftp, but over time, the thumbnails may be overwritten again.
Title: Re: New idea for better optimization of image previews
Post by: GJC Web Design on April 12, 2021, 12:21:30 PM
You can!!!!!

read the documentation!


https://docs.virtuemart.net/tutorials/templating-layouts/222-different-thumbnail-sizes.html
Title: Re: New idea for better optimization of image previews
Post by: pinochico on April 12, 2021, 12:47:22 PM
Thanks GJC for doc
Title: Re: New idea for better optimization of image previews
Post by: Studio 42 on April 15, 2021, 23:57:07 PM
YOu can have different size for different needs.
For eg a specific size in the modules, in the cart, in the category page, in the manufacturers. For related products, slideshows ...
So adding this as option in the config ????
Title: Re: New idea for better optimization of image previews
Post by: pinochico on April 16, 2021, 11:51:51 AM
Logic:
- 2 size in admin (or config)
- others size as call function in override view