Copied to clipboard

Flag this post as spam?

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


  • Pat O'Callaghan 34 posts 56 karma points
    Jul 04, 2013 @ 23:43
    Pat O'Callaghan
    0

    CropUp: Returning correct crops of too small images

    Hey,

    loving the CropUp tool and the simplicity in using it.

    It seems the default behaviour of the cropper is not to try and cut crops when an image is smaller than a crop. While this is a good default, I'd rather the cropper tries to return the correct crop size even if the image is slightly pixelated. Ideally we'd always want the client to put up the correct size images but we can't guarantee that. I may be missing something simple.

    I've been trying to working out what settings I need in the CropUp.

    Take the following example:

    Square Crop: 400px x 400px

    Uploaded Image: 400 x 350px

    URL 1:

    /CropUp/squarecrop/media/120806/image.jpg
    Returns: Original Sized image 400 x 350
    URL 2:
    /CropUp/squarecropZ/media/120806/image.jpg
    Returns: Required Crop Size 400 x 400 (cuts a square portion of the image and upscales)
    My code looks like the following:
    CropUp.GetUrl(sourceImage.UmbracoFile, new ImageSizeArguments { CropAlias = "squarecrop" })
    I've tried all the different CropMode enum (BestFit, Max, Min, Pad, Responsive) types but I can't get it to replicate URL 2 with the Z CropMode. The only way I can get it is to hardcode the URL rather than using the extension.
    Any ideas how to replicate URL in code?
    Thanks,
    Pat
Please Sign in or register to post replies

Write your reply to:

Draft