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

[solved] 'Used thumb url' empty after update to 3.0.12

Started by gba, November 16, 2015, 22:43:01 PM

Previous topic - Next topic

olejenya

$product->images[0]->getFileUrlThumb();
$this->product->images[0]->getFileUrlThumb();

Here are examples of workers who are interested

davidex2

Hello to all. These are days that I try to figure out how to fix this problem, but I just can not.

Someone could be more specific and explain step by step what you must do?

If I upgrade to 3.0.12 lose all thumbnails

Thank you all.

GJC Web Design

it depends on your template and often in things like 3rd party image zoom ext., 3rd party carts with thumbs, or additional thumbs in details etc

where they have a image url like below which simply got a databased stored url (which isn't stored now)

$thumb = $product->images[0]->file_url_thumb;

etc

you need to replace with the function

$thumb = $product->images[0]->getFileUrlThumb();
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Doomas

Is it possible that

$product->images[0]->getFileUrlThumb()

does not creat the thumbnail file?

I hade the case that today a customer reseted all thumbnails. And they wehre not automatically recreated. I had to insert follwing line to auto create the tumbs:

$product->images[0]->displayMediaThumb('',false);

Is this an intendet behavior or a bug?

jenkinhill

Maybe someone turned off "Enable Dynamic Thumbnail Resizing"
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

Doomas

No, this was also my first thought.

I took a quick look at the  code of getFileUrlThumb() and displayMediaThumb(). If I've not missed somthing creatThumb() is not called anyware inside getFileUrlThumb(). So you have to use dispalyMediaThumb() to make sure any missings thumbnails will be created. 

olejenya

How use $images = $manufacturer->images[0]->file_url_thumb;
do not works  $manufacturer->images[0]->getFileUrlThumb();
Another function is used for brands?What?

userakos

I have the same problem since I upgraded to 3.0.12.
The first thumbnail is created. The next thumbnails (in the same product) are not created in the resized folder.

What a mess...

jenkinhill

No problem creating additional thumbs here, except that they don't display correctly on the product images page until the product is closed & saved.  They appear in the resized folder OK.
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

stAn99

for the backward compatibility of extensions which do not use virtuemart functions, but rely on virtuemart objects such as the media object, i would suggest to modify:

\administrator\components\com_virtuemart\models\media.php

update whole function to this:

public function attachImages($objects,$type,$mime='',$limit=0){
if(!empty($objects)){
if(!is_array($objects)) $objects = array($objects);
foreach($objects as $k => $object){
if(!is_object($object)){
$object = $this->createVoidMedia($type,$mime);
}

if(empty($object->virtuemart_media_id)) $virtuemart_media_id = null; else $virtuemart_media_id = $object->virtuemart_media_id;
$object->images = $this->createMediaByIds($virtuemart_media_id,$type,$mime,$limit);

foreach ($object->images as &$image)
{
if (empty($image->file_url_thumb)) {
  $image->file_url_thumb = $image->getFileUrlThumb();
}
}
//This should not be used in fact. It is for legacy reasons there.
if(isset($object->images[0]->file_url_thumb)){
$object->file_url_thumb = $object->images[0]->file_url_thumb;
$object->file_url = $object->images[0]->file_url;
}
}
}
}



the main reason is that some extensions still rely on this variable:

$YagImage->urlThumb = JUri::base() . $vmImage->file_url_thumb;   

yagendoo template's
\plugins\system\yagendoo_system_plugin\src\framework_v1\ecm\libs\yag_helper\helper.image_mapper.php

and many others.

so instead of forcing to use a VM function it would be nice if VM would include this variable in a way that would be backward compatible.

best regards, stan, rupostel.com
----
RuposTel.com
www.rupostel.com
Your customized checkout solution for Virtuemart

Milbo

Quote from: Doomas on January 14, 2016, 17:17:19 PM
So you have to use dispalyMediaThumb() to make sure any missings thumbnails will be created. 

The intended way to use the vm media system. It was always wrong, that people used the file_url_thumb. The file_url_thumb is dynamic and can be different by size. The functions displayMediaFull() and displayMediaThumb() are the intended functions since vm2.0.0
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Thomas Kuschel


minista

I changed this code here:

// Output: Product Image
if ($product->images && $show['show_product_image'] == 'yes') {

$html.=     '<div class="product-thumbnail">';
$html.=         '<a href="'.$productLink.'" title="'.$product->product_name.'">';
$html.=             '<img src="'.JRoute::_($product->images[0]->file_url_thumb).'" itemprop="image" class="product-image" title="'.$product->product_name.'" alt="'.$product->product_name.'" />';
$html.=         '</a>';
$html.=     '</div>';

}


to this but nothing changed.... What am i doing wrong?

// Output: Product Image
if ($product->images && $show['show_product_image'] == 'yes') {

$html.=     '<div class="product-thumbnail">';
$html.=         '<a href="'.$productLink.'" title="'.$product->product_name.'">';
$html.=             '<img src="'.JRoute::_($product->images[0]->FileUrlThumb).'" itemprop="image" class="product-image" title="'.$product->product_name.'" alt="'.$product->product_name.'" />';
$html.=         '</a>';
$html.=     '</div>';

}

GJC Web Design

where did u get that from?

should be

$product->images[0]->getFileUrlThumb()
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation