Copied to clipboard

Flag this post as spam?

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


  • Richard van der Meel 13 posts 76 karma points
    Oct 10, 2016 @ 20:27
    Richard van der Meel
    0

    Quality Parameter for Images (GetCropUrl Azure Blob Storage)

    Hi All,

    I'm using GetCropUrl for images in Umbraco 7.4.3. while media is stored in Azure Blob Storage. Imageprocessor installed is version 2.4.4.

    The crops are working as expected. The image cache in Aure is also configured and working as expected.

    I'm experiencing a problem using the quality parameter (e.a. ?quality=70). It does not seem to effect the image.

    Anyone else have the same problem or know wat the problem is?

  • Jeavon Leopold 3005 posts 13193 karma points MVP 7x admin c-trib
    Oct 11, 2016 @ 08:19
    Jeavon Leopold
    0

    Hi Richard,

    Could you please post an example url where you have the issue?

    Jeavon

  • Richard van der Meel 13 posts 76 karma points
    Oct 11, 2016 @ 11:29
  • Jeavon Leopold 3005 posts 13193 karma points MVP 7x admin c-trib
    Oct 11, 2016 @ 11:34
    Jeavon Leopold
    0

    Either the quality processor is disabled or something is hijacking the request, can you check the processing.config file for

    <plugin name="Quality" type="ImageProcessor.Web.Processors.Quality, ImageProcessor.Web" enabled="true" />
    
  • Jeroen Breuer 4861 posts 12132 karma points MVP 3x admin c-trib
    Oct 19, 2016 @ 10:41
    Jeroen Breuer
    0

    We have the same problem. And tried the things in the topic.

    We're on Umbraco 7.4.3.

    We upgraded to ImageProcessor.Web 4.6.6.0.

    After that we changed our processing config to this: https://github.com/JimBobSquarePants/ImageProcessor/blob/Framework/src/ImageProcessor.Web/Configuration/Resources/processing.config.transform

    When we add the quality parameter it seems to return the original images and ignores all the parameters. Has anyone seen this before?

    Jeroen

  • Douglas Robar 3570 posts 4670 karma points MVP 6x admin c-trib
    Oct 19, 2016 @ 11:29
    Douglas Robar
    1

    Using the URL that Richard provided, it seems to be exactly as Jeroen describes. Resizing works but including the quality= parameter forces the original image to be returned with no resizing at all.

    Original image (1.3MB): https://www.newheroes.com/media/2846/homepage-still.jpg

    Resized to 400px (18.3KB): https://www.newheroes.com/media/2846/homepage-still.jpg?width=400

    Resize and set quality (1.3MB): https://www.newheroes.com/media/2846/homepage-still.jpg?width=400&quality=5

    According to http://umbraco.com/follow-us/blog-archive/2016/7/19/umbraco-750-beta2-released/, only a few commands will be run by default now for security reasons. Though the Quality= parameter should be one of them. And even if it were disabled the other querystring parameters should still fire, which isn't the case.

    cheers,
    doug.

  • Jeroen Breuer 4861 posts 12132 karma points MVP 3x admin c-trib
    Oct 19, 2016 @ 11:52
    Jeroen Breuer
    0

    In the ApplicationStarted event we have the following code:

    // Intercept ImageProcessor requests to alter output quality and file size.
    ImageProcessingModule.OnProcessQuerystring += (sender, args) =>
    {
        // if query string is empty, than we are not using the processor
        if (string.IsNullOrEmpty(args.Querystring))
        {
            return args.Querystring;
        }
    
        // reduce quality of jpg images to 85 percent
        if ((args.RawUrl.Contains(".jpg") || args.RawUrl.Contains(".jpeg")) && !args.Querystring.Contains("quality="))
        {
            return args.Querystring += "&quality=85";
        }
    
        if (args.RawUrl.Contains(".gif") || args.RawUrl.Contains(".png"))
        {
            return args.Querystring;
        }
    
        return string.Empty;
    };
    

    Not sure if that affects the above issue. It worked on Umbraco 7.3 (and the version of ImageProcessor that came with that).

    Our media is also stored in Azure Blob Storage.

    Jeroen

  • Jeroen Breuer 4861 posts 12132 karma points MVP 3x admin c-trib
    Oct 19, 2016 @ 12:33
    Jeroen Breuer
    0

    Upgraded from ImageProcessor.Web.Config 2.2 to 2.3, but that also didn't help.

    Jeroen

  • Jeroen Breuer 4861 posts 12132 karma points MVP 3x admin c-trib
    Oct 19, 2016 @ 13:19
    Jeroen Breuer
    101

    Sorry for all the confusion. Indeed it was a problem with our ImageProcessingModule.OnProcessQuerystring event.

    We updated this to the following code:

    // Intercept ImageProcessor requests to alter output quality and file size.
    ImageProcessingModule.OnProcessQuerystring += (sender, args) =>
    {
        // if query string is empty, than we are not using the processor
        if (string.IsNullOrEmpty(args.Querystring))
        {
            return args.Querystring;
        }
    
        // reduce quality of jpg images to 85 percent
        if (args.RawUrl.Contains(".jpg") || args.RawUrl.Contains(".jpeg"))
        {
            if (!args.Querystring.Contains("quality="))
            {
                return args.Querystring += "&quality=85";
            }
            else
            {
                return args.Querystring;
            }
        }
    
        if (args.RawUrl.Contains(".gif") || args.RawUrl.Contains(".png"))
        {
            return args.Querystring;
        }
    
        return string.Empty;
    };
    

    The old code always returned string.Empty if there was a quality parameter in the url. With this new version you can also use the quality parameter.

    Jeroen

Please Sign in or register to post replies

Write your reply to:

Draft