Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Sebastian Dammark 547 posts 1287 karma points
    Nov 27, 2014 @ 13:58
    Sebastian Dammark
    0

    Padding and imageprocessor

    Does anyone know if it's possible to decide where the padding is applied when running i pad mode ?

    Right now it's distributed equally top/bottom and left/right.

    But if I need to have 3 images scaled to fit within a crop and to align to bottom, I kinda need to distribute all padding from the top.

    http://imageprocessor.org/imageprocessor-web/imageprocessingmodule/resize.html

  • James Jackson-South 489 posts 1743 karma points c-trib
    Nov 27, 2014 @ 14:18
    James Jackson-South
    102

    I'm afraid not at present.

    Resize pad simply takes the size you have given and applies even distribution of padding to fit the image to the given aspect ratio.

    The crux of the method takes place here. Theoretically it would be possible to add the AnchorPosition enum calculations to pad in order to allow for your need.

    https://github.com/JimBobSquarePants/ImageProcessor/blob/V2/src/ImageProcessor/Imaging/Resizer.cs

    https://github.com/JimBobSquarePants/ImageProcessor/blob/V2/src/ImageProcessor/Imaging/AnchorPosition.cs

    If you fancy having a go I'm more than willing to accept pull requests. I don't have the time sadly to do it myself just now.

    This looks like a problem you could conceivably solve using CSS though.

    http://jsfiddle.net/v7og4r9w/

  • Sebastian Dammark 547 posts 1287 karma points
    Nov 27, 2014 @ 23:06
    Sebastian Dammark
    0

    Thanks.

    I knew about the CSS trick and it did solve the problem, for now.
    The only downside with the CSS trick is that it requires a fixed height. 

  • James Jackson-South 489 posts 1743 karma points c-trib
    Nov 28, 2014 @ 10:20
    James Jackson-South
    0

    No worries,

    I reckon you could solve that with flexbox or using table, table-cell since that allows alignment. I just knocked up the first thing I thought of.

    You have definitely given me something to think about though. It would certainly be a nice addition to be able to determine the padding direction so I'll try and get that added sometime soon.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies