Updated to crop 8.1.2 and the image on IE 11 wont load. But this just happens when the image styles have been generated for the first time on the disk. After that, it works fine. Later I tried it also with 8.1.1 and the result is just the same. Only downgrading to version 8.1.0 the issue won't appear.

For reproducing the issue, you just need to flush the image style and then load the site on IE 11 (load the site on a private Mode, to avoid browser caching). It happens mainly with big header images and only on IE11. On Chrome it works great.

Tested the issue also with the patch on https://www.drupal.org/node/2868638, but no success.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

lulbina created an issue. See original summary.

lulbina’s picture

Version: 8.x-1.1 » 8.x-1.x-dev
woprrr’s picture

Status: Active » Postponed (maintainer needs more info)

Sadly I can’t reproduce this bug actually because I’m on Mac OS system but during fixes and optimisations of file_uri génération yesterday this problème can be solve. Please can you retest it and make me a feed-back ? (Close issue of all work well ;))

woprrr’s picture

Hi @lulbina,

The problem persist with last version of drupal and crop api ? That kind of error can be due to an image with transparency it's you case ?

fdverwoerd’s picture

I had a similar problem and its because '&' becomes escaped to '&amp';. I am still not sure whats causing this... If it's crop, or hook_file_url_alter or even something else.

See example url:

localhost/sites/default/files/styles/social_media/public/2018-02/04113_london_2560x1440.jpg?h=478ed3c2&itok=7xKWG8UK

In crop_file_url_alter() there is something like this

// Append either with a ? or a & if there are existing query arguments.
      if (strpos($uri, '?') === FALSE) {
        $uri .= '?h=' . $shortened_hash;
      }
      else {
        $uri .= '&h=' . $shortened_hash;
      }

But the uri inside crop_file_url_alter never has query parameters as far as I tested. So It's always ?h the first one. Then the Itok parameter gets appended and escaped somewhere?

Modules used: Crop API, Image Widget Crop

DarkstarTom’s picture

I am on MacOS and Chrome and I am also having this problem. Using crop 8.x-1.2 with Image Widget Crop 8.x-2.1 works fine but when I upgrade crop to either 8.x-2.0-rc1 or 8.x-1.5 I see the problem.

@fdverwoerd is correct as the problem is caused by the '&' being incorrectly formatted.

woprrr’s picture

Status: Postponed (maintainer needs more info) » Needs work
Issue tags: +DevDaysLisbon

I will see this fast !

woprrr’s picture

Status: Needs work » Postponed (maintainer needs more info)
FileSize
529.86 KB

After some tests with 2.x and iwc and last version of drupal 8.5 it's impossible to reproduce your problems.

I evry cases uri_alter and all drupal internal uri are automatically encoded by core the problem does be another module / dev add this & explicitly ? If I add this & directly in $uri to reproduce your problem the url show me the & but not break the image.

Can you describe more your current drupal stack ? or export your configuration ?

erichomanchuk’s picture

I'm having a similar issue related to the meta tag module.

Using Crop 8.x-2.0-rc1 and ImageWidgetCrop 8.x-2.2

I'm using tokens to print the media image url to the og:image tag. When using an image style that uses crop it outputs the url like this. The ampersand is escaped breaking the image.

sites/default/files/styles/social_image/public/assets/images/animal-animal-photography-cat-104827.jpg?h=d51975f4&itok=I69sAKnS

Here was the same issue on imageWidgetCrop

https://www.drupal.org/project/image_widget_crop/issues/2932274