Copied to clipboard

Flag this post as spam?

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


  • Darren Eccles 59 posts 298 karma points
    Nov 20, 2018 @ 15:12
    Darren Eccles
    0

    help - image cropper not working in back office after upgrade from 7.2.4 to 7.11.1

    Hi Guys,

    Struggling to find a solution for this.

    After upgrading from 7.2.4 to 7.11.1 (link to upgrade process) the image cropper does not work properly.

    Whats happening?

    I can select an image using the image cropper with a custom crop. I then click 'save and publish' in the back office and everything seem fine. But once I refresh the page the image is gone.

    It seems to be putting the media item into the file system, but not in the database, so there is no reference of the image.

    I have checked the web.config file and I have two references to the image processor modules.

    I've been into my datatype and re-saved

    I've also created a new custom image cropper datatype with and without custom crops and I still get the same problem.

    Also, I'm not using this in archetype.

    If anyone can give any advice on this?? it would be much appreciated.

    The only solution I can see at the moment is to drop the image cropper and use a media picker instead (I want to avoid this if possible).

    Thanks

    Darren

  • Darren Eccles 59 posts 298 karma points
    Nov 20, 2018 @ 17:28
    Darren Eccles
    0

    Update

    Got a little bit further with this, I've found out why its not working .

    I have an IApplicationEventHandler that checks for any files that are trying to be viewed including files that are displayed on the web page (bit of a file security layer I written).

    Anyway in the code I have the following:

    string mediaPath = "/media/" + id + "/" + file;     
    IMediaService mediaService = ApplicationContext.Current.Services.MediaService;
    IMedia media = mediaService.GetMediaByPath(mediaPath);
    

    the variable 'media' returns null and therefore I don't request the image hence not showing it on the page including the back-office after I refresh.

    So the problem is with 'mediaService.GetMediaByPath(path)'. If I upload an image to the media section this method works, however if I upload a image via the image cropper, 'mediaService.GetMediaByPath(path)' doesn't work??!!!

    It looks like the image cropper is creating the folder and file in the file system e.g. '/media/id/image.jpg', however it doesn't look like its creating a new row in the 'cmsMedia' table so the method GetMediaByPath can reference.

    Need help on this guys, got a feeling this may be a restriction with the image cropper and GetMediaByPath method, hope I'm wrong :(

    Darren

  • Darren Eccles 59 posts 298 karma points
    Nov 20, 2018 @ 17:58
    Darren Eccles
    0

    Another Update,

    I've managed to update my code to handle the null value for now, however it would be good to find out if there is a restriction with the image cropper and GetMediaByPath method.

    Darren

Please Sign in or register to post replies

Write your reply to:

Draft