how to crop an image to given size?
  • How to get cropped image? Now I get image by {{uri options="image 1 width 75 height 60" }} which gives me scaled image to this height or width but I need to get it in this exacly given size.
  • 3 Comments sorted by
  • Vote Up0Vote Down Micz FlorMicz Flor
    Posts: 184Administrator
    this is not yet implemented:
    http://dev.sourcefabric.org/browse/CS-3100
    please comment to the ticket if you think it is an important feature to have.

    currently, i am using a workaround, wrapping the image in a div with fixed size and overflow hidden.
  • how You get image in minimum 75x60 size to fill the div?
  • Vote Up0Vote Down Micz FlorMicz Flor
    Posts: 184Administrator
    yes, as i said, it is a tweak. (please comment to the ticket above).

    i do it in approximation. image bigger than div and cut div. something like:

    <div style="width:75px; height:60; overflow:hidden;">  
    then use: {{uri options="image 1 width 90 height 90" }}


    as rough as this...

    you can even be more precise by using the image as a background image and center it. i haven't tested this piece of code, but something like:

    <div style="
      width:75px; 
      height:60; 
      background:url(put here {{uri options="image 1 width 90 height 90" }}) center center no-repeat;
    ">