0

I'm using CE Image 2.4.5 on EE 2.9.3 and it outputs the image cropped correctly. However I also need the {height} and {width} variables elsewhere. The problem is that both of these variables are ouputting the original value and not the cropped value as suggested by the docs.

For example this code:

<p>{exp:ce_img:pair src="{url}" width="300" height="100" url_only="no" crop="yes" quality="100"}h: {height} {height_orig}, w: {width} {width_orig}, u: {made}{/exp:ce_img:pair}</p>

outputs the following:

<p>h: 614 614, w: 480 480, u: /path/to/d1small_300_100_c1.jpeg</p>

Any idea how to resolve this?

  • Know this sounds odd - but since you are manually specifying the width and height of the image in the ce_img tag, why do you need ce_img to tell you what the cropped width and height are...? – JCOGS Design Dec 30 '16 at 17:19
  • Using a lazy loading script that needs the images height/width. The code above was me testing to find out why it wasn't really working. The real code only sets width and let's ce image set the height,thus I don't know the dimensions of images. – CreateSean Dec 30 '16 at 20:03
1

We are using the following without any issue:

{exp:ce_img:pair src="{logo}" height="75" width="150"}
<img src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEAAAAALAAAAAABAAEAAAI=" data-original="{sized}" width="{width}" height="{height}" alt="{title}">
{/exp:ce_img:pair}

Ensure that the cache folder for the resized images has the correct permissions. I believe that folder defaults to /images/sized

If the permissions are not correct, then the image doesn't get resized and I believe the resized width and height remain as the original width and height.

| improve this answer | |
  • No -that does not work it outputs this: <img src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEAAAAALAAAAAABAAEAAAI=" data-original="/path/to/DB_Portraits-40_50_75.jpg" width="1000" height="1500" alt=""> – CreateSean Jan 4 '17 at 15:45
  • The image in "/path/to/DB_Portraits-40_50_75.jpg" is properly resized to 50x75 and exists? – Out of Control Jan 4 '17 at 21:48
  • Yes it does exist. – CreateSean Jan 5 '17 at 13:41
  • …and for completeness, when you preview "/path/to/DB_Portraits-40_50_75.jpg" directly in the browser, it shows as being 50x75 and not the original size of 1000x1500? We need to ensure that the server actually had the memory to resize the image properly. – Out of Control Jan 5 '17 at 17:15
  • Yes, just checked locally – CreateSean Jan 5 '17 at 17:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.