3

I've got some images that are not square (portrait and landscape format), but I want them cropped square with CE Image.

I've tried various parameters from the documentation, but the results are stretched unnaturally. I'd prefer to have the image cropped to center and not scaled.

{exp:ce_img:single src="{image}" filter="grayscale" filename_suffix="-OFF" unique="none" class="fadein" max="192" crop="yes|center,center|0,0|no"}
1
  • Have you tried with crop turned on AND setting the width and height? Also, have you tried with smart scale on?
    – Natetronn
    Commented Dec 4, 2012 at 3:01

2 Answers 2

2

What Brett suggested above should work. Maybe you can try with the tag pair approach ? Again, very simple example you can build upon.

{exp:ce_img:pair src="{cf_news_img}" width="200" height="200" crop="yes|center,center"}<img src="{made}" alt="{title}" />{/exp:ce_img:pair}
2
  • Looks like you are using imgsizer vs CE Image in your example.
    – Natetronn
    Commented Dec 5, 2012 at 7:00
  • Indeed, corrected ... more thee needed Commented Dec 5, 2012 at 20:39
12

This has always worked for me:

{exp:ce_img:single src="{url}" width="200" height="200" crop="yes|center,center" }

You can obviously add any additional paramaters (offset, filter, etc), but give this simple example a shot and try adjusting from there.

1
  • exactly what I was going to suggest.
    – CreateSean
    Commented Dec 5, 2012 at 20:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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