Copied to clipboard

Flag this post as spam?

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


  • Steven Harland 78 posts 518 karma points c-trib
    Sep 04, 2015 @ 08:03
    Steven Harland
    0

    Regenerate Thumbnails in Umbraco 7

    Hi all,

    I'm working on an Umbraco 7.2.8 site that allows the upload of images on the front end. Users also have the ability to crop and rotate their images, also on the front end. This works fine and the thumbnail shown in the media section for that image is a thumbnail for the rotated/cropped version.

    I've ported the same functionality to the backoffice as part of a property editor. The server-side code that manipulates and replaces the media file is shared. However, when an image is rotated/cropped through the backoffice the thumbnail is not updated.

    This is the thumbnail returned by the following API call:

    /umbraco/backoffice/UmbracoApi/Images/GetBigThumbnail?originalImagePath=/media/image.jpg
    

    So I have a couple of questions:

    1. Why would the thumbnail not be getting updated?
    2. Is there anything I can do to force the thumbnail to be regenerated? I have tried manually saving the image in the media section but that doesn't work and I need a programmatic approach anyway.

    Thanks.

    Steven.

  • Marc Goodson 2136 posts 14298 karma points MVP 8x c-trib
    Sep 07, 2015 @ 18:48
    Marc Goodson
    100

    /umbraco/backoffice/UmbracoApi/Images/GetBigThumbnail?originalImagePath=/media/image.jpg

    will return the file

    /media/image_big-thumb.jpg

    if it already exists on disk (which it will do from the first pre-mangled upload)

    and so appear incorrect.

    If you delete this file on disk after the translation of the original image, and then call:

    /umbraco/backoffice/UmbracoApi/Images/GetBigThumbnail?originalImagePath=/media/image.jpg

    Umbraco should recreate the image based on the new translated image file

  • Steven Harland 78 posts 518 karma points c-trib
    Sep 08, 2015 @ 07:32
    Steven Harland
    0

    Thanks Marc, that's done the trick.

Please Sign in or register to post replies

Write your reply to:

Draft