Jump to content

automatically generated thumbs with crop


Recommended Posts

I want to change a little bit auto-thumbnail generator - instead of adding white margin, i want to crop them.

when we have e.g. 600x400px picture, first it changes into a square 600x600 and than resizes. I want to make it center crop to 400x400 (cut 100px from both sides) and than resize. This should work for every thumbnails except thickbox.

Any ideas?

Link to comment
Share on other sites

  • 3 weeks later...

Nice design!

I think I understand now. So you want to crop the image so that it fills the whole square?

You'll need to mess around with the code in images.inc.php. I think you might be able to get it to resize by height instead of width or vice versa, which may give you what you want. I can't think of the code to do it off-hand though. I can only find these posts here and here.

Link to comment
Share on other sites

thanks ;) this shop i based on Wallcraft skin http://photosalgerie.free.fr/wallcraft/
but totally modified and not finished yet.

i thought just like you said, about switching width&height;, but i want to do this for every thumbs except thickbox - it should present whole picture in fact.
If anyone have any idea, i would be nice :) i`ll try to change images.inc.php a little bit.

Link to comment
Share on other sites

but how should we cope with a thickbox enlargement?
i did

 

getImageLink($cover.id_image)}" {if $jqZoomEnabled}class="jqzoom" alt="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'thickbox')}"{else} title="{$product->name|escape:'htmlall':'UTF-8'}" alt="{$product->name|escape:'htmlall':'UTF-8'}" {/if} id="bigpic"/>



but there is still a zooming problem :/


SOLVED AGAIN


go to themes/xxx/js/product.js

find

function displayImage(domAAroundImgThumb)
{
   if (domAAroundImgThumb.attr('href'))
   {
       var newSrc = domAAroundImgThumb.attr('href').replace('thickbox','large');



and change into e.g.

function displayImage(domAAroundImgThumb)
{
   if (domAAroundImgThumb.attr('href'))
   {
       var newSrc = domAAroundImgThumb.attr('href').replace('w600','w300-h300-c1:1');



in product.tpl thumbnails should look like:




good luck ! ;)


there is an error in form, it eats my code part. below you've got missing part (delete spacebars)

< a h r e f =" { $base_dir } mini/w600/img/p{$link->getImageLink($imageIds)}" rel="other-views" class="{if !$jqZoomEnabled}thickbox{/if} {if $smarty.foreach.thumbnails.first}shown{/if}" title="{$image.legend|htmlspecialchars}">

e]


getImageLink($imageIds)}" rel="other-views" class="{if !$jqZoomEnabled}thickbox{/if} {if $smarty.foreach.thumbnails.first}shown{/if}" title="{$image.legend|htmlspecialchars}">

getImageLink($imageIds)}" alt="{$image.legend|htmlspecialchars}"/>


Link to comment
Share on other sites

  • 5 months later...
×
×
  • Create New...