Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
Thank you for a wonderful module. One issue I found is if Minify Source HTML is enabled, the image preview for an image upload fails and gives a content-length error.
Comment | File | Size | Author |
---|---|---|---|
#16 | image_upload_ajax_fix-2887928-15.patch | 1.92 KB | slydevil |
Comments
Comment #2
slydevil CreditAttribution: slydevil commentedAre you using any contrib modules to handle the image preview?
Comment #3
sense-designYes, I am using Focal Point
Comment #4
slydevil CreditAttribution: slydevil commentedI've installed the focal point module and it is working just fine for me. Can you elaborate more on what issue you are facing, steps to reproduce, etc.
Comment #5
sense-designUsing these modules:
* Paragraphs with simple bundle with image field
* Transliteration
* Image Field Caption
* Focal point
* ImageMagick
Server software:
* ngnix
When uploading a picture the following errors occurs in Debug console:
"/sites/default/files/styles/thumbnail/public/pictures/paragraphs/name-of-file.jpg?itok=88D3Tsr5:1
GET https://www.domain.tld/sites/default/files/styles/thumbnail/public/pictu... net::ERR_CONTENT_LENGTH_MISMATCH"
Maybe I could give you access to the DEV site to have a look at the error.
Comment #6
heinc8 CreditAttribution: heinc8 commentedNo, I'm not using a contrib module to generate the preview. When Minify Source HTML is enabled, after you've uploaded an image, the browser shows it can't load the preview and the console delivers the ERR_CONTENT_LENGTH_MISMATCH error. When Minify Source HTML is switched off, it renders the preview correctly. It does the same in all browsers. I'm using jQuery Update and Speedy. Turning off Speedy doesn't solve the issue.
Comment #7
heinc8 CreditAttribution: heinc8 commentedI think it might be related to generating styles. When it shows the thumbnail, it is generating the style for the first time. It may happen too late and the size the browser expects is different to what it receives (the style image vs the original one).
Comment #8
slydevil CreditAttribution: slydevil commented@sense-design, access to a dev site would help. I cannot reproduce this at all...it always works. It could be related to the server configuration.
Comment #9
slydevil CreditAttribution: slydevil commentedMy personal contact form, cannot verify if it is actually there or not though
https://www.drupal.org/user/1846786/contact
Comment #10
slydevil CreditAttribution: slydevil commentedCan you confirm if you have compression enabled? If so, try the latest release 7.x-1.1 which should fix the issue.
Comment #11
heinc8 CreditAttribution: heinc8 commentedThanks. I'll test it and let you know.
Comment #12
pavloki CreditAttribution: pavloki commentedI have same error. When style have not yet created (first time access to style image) - there is an error in browser "content lengh". It seems like module Minify Source HTML trying to minify also images.
Ngix config look like this:
# Try to get image:
location ~* \.(pdf|asc|dat|txt|doc|xls|ppt|tgz|csv|png|gif|jpeg|jpg|ico|swf|css|js|json|svg)$ {
log_not_found off;
try_files $uri @rewrite;
expires 30d;
}
# There is no image - so do this:
location @rewrite {
rewrite ^/(.*)$ /index.php?q=$1;
}
So the final request to drupal seems like this http://site.com/index.php?q=sites/default/files/styles/large/public/imag...
And as I understood Minify Source HTML is minifing jpg image from url http://site.com/index.php?q=sites/default/files/styles/large/public/imag...
Please, fix it!
Comment #13
pavloki CreditAttribution: pavloki commentedI have same error. When style have not yet created (first time access to style image) - there is an error in browser "content lengh". It seems like module Minify Source HTML trying to minify also images.
Ngix config look like this:
# Try to get image:
location ~* \.(pdf|asc|dat|txt|doc|xls|ppt|tgz|csv|png|gif|jpeg|jpg|ico|swf|css|js|json|svg)$ {
log_not_found off;
try_files $uri @rewrite;
expires 30d;
}
# There is no image - so do this:
location @rewrite {
rewrite ^/(.*)$ /index.php?q=$1;
}
So the final request to drupal seems like this http://site.com/index.php?q=sites/default/files/styles/large/public/imag...
And as I understood Minify Source HTML is minifing jpg image from url http://site.com/index.php?q=sites/default/files/styles/large/public/imag...
Please, fix it!
7.x-1.1 have same problem, not fixed.
Comment #14
heinc8 CreditAttribution: heinc8 commented@slydevil, unfortunately, it is still an issue.
I had to add the following at line 36 of minifyhtml.module to ensure that it doesn't try to process any paths with extensions.
Comment #15
heinc8 CreditAttribution: heinc8 commentedComment #16
slydevil CreditAttribution: slydevil commentedCheck the attached path, see if it does the trick. It's essentially the same as the code you posted.
Comment #17
heinc8 CreditAttribution: heinc8 commented@slydevil, thanks, I'll try it today.
Comment #18
heinc8 CreditAttribution: heinc8 commented@slydevil. Thanks, #16 works.
Comment #20
slydevil CreditAttribution: slydevil commentedComment #21
slydevil CreditAttribution: slydevil commented