News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Maybe bug in product edit - image

Started by hazael, March 01, 2023, 16:00:45 PM

Previous topic - Next topic

hazael

If I turn off the automatic generation of thumbnails in the Virtuemart settings, I can't see the graphics in the administration panel. Image links link to thumbnails that don't exist.

In general, I want to give up automatic thumbnail creation - it's an old solution that should be abandoned. Now the most optimal solution are adaptive images.
The size of the generated graphics should depend on the size of the screen - responsive images with srcset attribute.
In the case of the old solution, the photos are scaled (stretched) or too large and reduced


VirtueMart 4.0.12 10777

StefanSTS

What graphics in administration panel exactly do you mean?
Do you have a screenshot?

Stefan
--
Stefan Schumacher
www.jooglies.com - VirtueMart Invoice Layouts

Please use only stable versions with even numbers for your live shop! Use Alpha versions only if you know what risk you are taking.

Milbo

We have "adaptive" images already. It is just a matter of your template using it. Even the main image could be already a thumb. Vm creates for any given solution a new thumb

function displayMediaThumb($imageArgs=array(),$lightbox=true,$effect="rel='group'",$return = true,$withDescr = false,$absUrl = false, $width=0,$height=0){

Just fill the last two params and a new thumbnail with the correct size is generated. And of course you can leave one 0 to prevent distortion.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

pinochico

#3
For seo is better load inside function last two value as calculate from thumb from FTP (and before define size in vm config)
Then your thumb images will be ok for google pagespeed insight.

The best option is add ratio for elmiminate CLS (again for google pagespeed insight).

Is very easy add as new params to this thumb function, value you have from calculate form size if thumb in FTP :)

P.S.
URL: administrator/components/com_virtuemart/helpers/mediahandler.php

function displayIt

add now code:


$size = getimagesize($_SERVER['DOCUMENT_ROOT'] . '/' . $this->file_url );



$image = '<img src="' . $image_href . '" alt="' . $file_alt . '" title="' . $file_alt . '" ' . $imageArgs . ' width="' . $size[0] . '" height="' . $size[1] . '" style="aspect-ratio: ' . $size[0] . ' / ' . $size[1] . '"/>';
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

hazael

#4
Thanks for the instant reply :)
Generally, I can't see some photos of products in the Virtuemart in product editing, if I disable thumbnail generation - looks a bit like a bug. Other than that, the site works realy good for me. :)


I didn't even know I could do this directly in Virtuemart - thanks for the tips - come in handy for the new page  :)
At the moment I'm using an external plugin to generate thumbnails. For example one picture now looks like this:

<img data-srcset="/images/virtuemart/product/image.webp 480w, /768/images/virtuemart/product/image.webp 768w, /992/images/virtuemart/product/image.webp 992w, /images/virtuemart/product/image.webp 1200w" sizes="100vw"
data-src="/images/virtuemart/product/image.webp"
srcset="/480/images/virtuemart/product/image.webp 480w, /768/images/virtuemart/product/image.webp 768w, /992/images/virtuemart/product/image.webp 992w, /images/virtuemart/product/image.webp 1200w"
src="/images/virtuemart/product/image.webp" />

hazael

#5
PS.

Milbo, do you plan to add categorization to product photos in the future? For me, the product page has several different types of images. They are displayed in different places.
My images are categorized by the name of the file description. But it's a bit inconvenient. It would be nice if there were real editable image categories for products.

for ($i = 1; $i < count($this->product->images); $i++) {$image = $this->product->images[$i];if (strpos($image->file_description, "type1") !== false){ $this->product->images[$i]->file_url; }}

pinochico

QuoteAt the moment I'm using an external plugin to generate thumbnails. For example one picture now looks like this:

Yes, we use the external plugin too, but this plugin use our little hack in function DisplayIt.

For example one picture now looks like this:


<picture alt="CBD konopná směs 1,6% BIO 35g" class="featuredProductImage" border="0" style="aspect-ratio: 200 / 200;" height="150" width="150">
<source type="image/webp" srcset="/images/stories/virtuemart/product/resized/konopny_caj_biocbd_cz-sk__mockup2_200x200.webp" alt="CBD konopná směs 1,6% BIO 35g" class="featuredProductImage" border="0" style="aspect-ratio: 200 / 200;" height="150" width="150">
<source srcset="/images/stories/virtuemart/product/resized/konopny_caj_biocbd_cz-sk__mockup2_200x200.jpg" type="image/jpeg" alt="CBD konopná směs 1,6% BIO 35g" class="featuredProductImage" border="0" style="aspect-ratio: 200 / 200;" height="150" width="150">
<img src="/images/stories/virtuemart/product/resized/konopny_caj_biocbd_cz-sk__mockup2_200x200.jpg" alt="CBD konopná směs 1,6% BIO 35g" class="featuredProductImage" border="0" style="aspect-ratio: 200 / 200;" height="150" width="150">
</picture>
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products