Problems, need help? Have a tip or advice? Post it here.
7 posts Page 1 of 1
I am using the gallery feature http://www.couchcms.com/docs/concepts/photo-gallery.html of CouchCMS. Image thumbnail is always created as a cropped version of the main image. I need to have the thumbnail to be just the resized version of the main image. No need to preserve the aspect ratio.
Code: Select all
<cms:template title='Categories' clonable='1' dynamic_folders='1' gallery='1'>
   <cms:editable
      name="gg_image"
      label="Product Image"
      desc="Upload product main image"
      width="600"
      height="600"
      enforce_max='1'
      show_preview='1'
      preview_height='300'
      required='1'
      type="image"
   />

   <cms:editable
      name="thumb"
      assoc_field="gg_image"
      label="Thumbnail"
      desc="thumbnail"
      width='200'
      height='200'
      enforce_max='0'
      type="thumbnail"
   />
</cms:template>
Hello and welcome, badawym :)

The gallery template requires a thumbnail region named gg_thumb which is used by Couch for displaying the image thumbnails in the admin panel. The snippet you posted does not have the said region. I suppose you've pasted an excerpted version of your code.

Anyways, coming to your question -
please try making the enforce_max parameter of the thumbnail '1' (instead of the current '0' which is causing it to get cropped. With enforce_max, the thumbnail will simply be a scaled-down version of the main image (none of the dimensions ever exceeding the width and height set (200 in your case) ).

Hope this answers the query. In case I was not able to understand the question right, please take a look at http://www.couchcms.com/docs/tags-refer ... bnail.html where you'll find all the parameters illustrated. I'm sure you'll be able to find the setting you require.

Thanks.
Thanks KK :) and yes It was an excerpt from my code, I have the gg_thumb in place.

Regarding your proposed solution, setting enforce_max to '1' will preserve the aspect ratio of the image which is going to result in variable thumbnail sizes depending on the album images uploaded. I mean with that I cannot fix the dimensions of the generated thumbnail to exactly 200px x 200px. And that's what I want to do. It is the same effect that is found on editable image with enforce_max='0' and crop='0' width='xxx' height='xxx'
I had a feeling I was not understanding the problem correctly.

Please let me reiterate the problem to make sure I got it right this time -
1. Your original code created thumbnails of exact 200x200px size. You do not want this because the image can be cropped.
2. My code created thumbnails that were scaled down version of the original image but never exceeding 200x200px. You do not want this because it resulted in variable dimensions.

OK. So the only other possibility that remains is the following -
Thumbnails of exact 200x200px size but no cropping.
This will result in squashing the image like this -
Original:
example2.jpg
example2.jpg (29.28 KiB) Viewed 2866 times

Thumbnail:
example2t.jpg
example2t.jpg (8.2 KiB) Viewed 2866 times

Can you please confirm that it is indeed what you want?
Thanks.
YES, that's exactly what I need to accomplish. I am concerned more about fixing thumbnail dimensions more than squashing it.
Thanks for confirming.
Unfortunately, it never occurred to me that someone would want to have distorted thumbnails like that :)
So, I am afraid, but there is no setting in Couch to create such thumbnails. However, I think, we can use a workaround -
Create the scaled thumbnails (i.e. enforce_max='1') and in your HTML code where you display the thumbnail specify a fixed width and height e.g.
Code: Select all
<img src="<cms:show thumb />" width="200" height="200" />

This way you'll get the kind of thumbnails you wish.

That said, I'll still say that the normal 'cropped' thumbnails should be better. They do have the fixed dimensions that you are looking for and the cropping can be manually tweaked if some important info is getting cropped away (in any case, a cropped image, IMHO, is better than a squashed one).
this image thumbnail can be created if you choose the right width and height.
i have tried with this snippets on generating thumbnail vb. give a try, hope it is what you are looking for.
7 posts Page 1 of 1
cron