Closed (fixed)
Project:
Remote image
Version:
8.x-1.0-beta1
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
15 Sep 2017 at 16:27 UTC
Updated:
21 Dec 2021 at 13:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
3cwebdev commentedComment #3
3cwebdev commentedComment #4
tuchoI have made another aproach to this problem, taking into account the possibility that getimagesize may not be available or it can not have access to remote files.
The patch that I uploaded only adds the #width and #height indexes on the field render array when they have a non empty value.
This change takes advantage of the logic of the template_preprocess_image function (defined in the file core/includes/theme.inc), which only adds the corresponding attribute to the img tag if it is defined on the render array:
If the width attribute and the height attribute is not set, the browser would use the original image size.
If the width attribute or the height attribute is not set, the browser would use defined dimension, resizing the other proportionally.
I have also modified the RemoteImageWithMetadataFormatter, so it explains what was mentioned previously.
Comment #5
nicolash commentedI've successfully tested both separately. A combination of the 2 approaches would be great, as in first see if getimagesize works and if so use that. If not use the approach in #4 of not setting anything.
Either way, both are better than the current state, which probably won't work for most people unless they always manually get the dimensions and enter them.
Comment #6
nicolash commentedComment #7
gaurav.kapoor commentedI am inclined towards going with the solution provided in #4. The patch would require a reroll and removal of some of the changes it is introducing as those have been pushed as part of other commits.
Comment #9
gaurav.kapoor commentedPushed the fix for this. Thanks for working on this module.