Skip to main content

Custom field Ajax image resize

More
6 years 3 months ago #320498 by mojweb
-- HikaShop version -- : 4.3

Hello
I have this code in product view
Code:
<?php if(!empty($this->element->autorfoto)) { $fieldClass = hikashop_get('class.field'); $field = $fieldClass->getField('autorfoto', 'product'); echo '<div class="col-sm-2 avtorphot">' . $fieldClass->show($field,$this->element->autorfoto) . '</div>'; } if(!empty($this->element->autortext)) { echo '<div class="col-sm-10 avtortekst">' . $this->element->autortext . '</div>'; } ?>

First field is custom image, second is custom text. Image is resized to 100x100. What code to use for biger image, say 150x150?

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

More
6 years 3 months ago #320505 by nicolas
Hi,

Supposing that the type of the custom field is "ajax image", you can change the line:
Code:
echo '<div class="col-sm-2 avtorphot">' . $fieldClass->show($field,$this->element->autorfoto) . '</div>';
to:
Code:
echo '<div class="col-sm-2 avtorphot">' . str_replace(array('thumbnail_x=100','thumbnail_y=100'), array('thumbnail_x=150','thumbnail_y=150'), $fieldClass->show($field,$this->element->autorfoto)) . '</div>';

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

More
6 years 3 months ago #320563 by mojweb
Sorry, no change.
Cleared cache, uploaded new image...

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

More
6 years 3 months ago #320565 by nicolas
Hi,

Try like that then, as you might have SEF on:
Code:
echo '<div class="col-sm-2 avtorphot">' . str_replace(array('thumbnail_x=100','thumbnail_y=100','thumbnail_x-100','thumbnail_y-100'), array('thumbnail_x=150','thumbnail_y=150','thumbnail_x-150','thumbnail_y-150'), $fieldClass->show($field,$this->element->autorfoto)) . '</div>';

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

More
6 years 1 month ago #322821 by mojweb
Sory still no change.
With inspector I see html
Code:
<img class="" src="/zc/order/download/field_table-product/field_namekey-YXV0b3Jmb3Rv/name-a2V6ZWxlLmpwZWc=/thumbnail_x-190/thumbnail_y-190" alt="keze.jpeg">
But image is 100px.

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

More
6 years 1 month ago #322826 by nicolas
Hi,

Then it means that the image itself is smaller than 190*190. The system will only resize down the uploaded image if it is bigger than the size specified in the parameters of the URL. OR, the image is actually resized to 190*190 and you have CSS on that area which has the browser resize the image to 100*100 dynamically when displaying the image.
I can't say for sure without looking at the page itself and checking myself with the inspector of my browser.

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

More
6 years 1 month ago - 6 years 1 month ago #322831 by mojweb
I uploaded 600px image. So must be some resize problem.
Last edit: 6 years 1 month ago by mojweb. Reason: link removal

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

More
6 years 1 month ago #322859 by nicolas
Hi,

Thanks for the link. I think I've found the problem.
The thumbnail size parameters in the URL of custom ajax image fields where not properly taken into account.
Please download again the install package of HikaShop on our website and install it on yours and it will add a patch which should make it work properly.
The following user(s) said Thank You: mojweb

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

More
6 years 1 month ago #323110 by mojweb
Now is ok.
Thank you
The following user(s) said Thank You: Philip

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

Time to create page: 0.227 seconds
Powered by Kunena Forum