Calling image_load() on image file entities is expensive since it has to make a call to getimagesize() for GD. We made a huge mistake in core by adding the height and width attributes for image files into the field schema itself, rather than adding that data into an {image_dimensions} table that could be easily joined onto the {file_managed} table for saving and then loading into a file entity via hook_file_load(). The moment we want to make file entities re-usable and reference-able, we currently have to re-call image_get_info() rather than being able to rely an reusable data.
Comments
Comment #1
Dave ReidRelated issue in the Media and File entity projects: #1447790: image_load makes admin/content/media unusably slow
Comment #2
Dave ReidOriginal issue: #908282: Remove unnecessary I/O from theme_image()
Comment #3
Dave ReidComment #4
yang_yi_cn CreditAttribution: yang_yi_cn commented#1345744: cropped image has incorrect metadata width and height in imagefield is related.
For those don't have time to look over, the issue summary is:
The imagefield_crop module crops the original image file and updates the file correctly.
However, in #file_value_callback it can only update the fid related data which is in the {file_managed} table, thus the width / height in the image field instance table would never be updated.
Causing problems whenever try to use the "Original image" display.
Comment #5
markconroy CreditAttribution: markconroy commentedhas this issue been sorted? It's quite frustrating to use image preset "small-image" set to scale to 120px, then update the preset to 133px (for example) because that fits better with the content region dimensions for a particular theme, but the image dimensions stay the same (with the result being a pixellated image).
In more detail:
http://drupal.org/node/1786488
Mark C.
Comment #6
familymangreg CreditAttribution: familymangreg commentedHi all,
Would be pleased to know a work around or the status of a fix to this issue. Having a few days at the moment where I'm getting really frustrated with Drupal. On the forums so much investigating and reporting issues which seem to often fall back to a core update.
I'm having the problem with 7.15. Images are cropped to the correct size, but output as original they have the wrong (or original dimension) in the image tag when output.
Its annoying because I've used image and cropping on upload so much in the past and never had this issue.
Cheers,
:wq
Comment #7
DamienMcKennaRegarding imagefield_crop shouldn't it just have extra hook implementations to update the table accordingly? Is there an API limitation as to why this isn't possible?
Comment #8
klonos...I was (re)reading File management (File entity in core) and FMI roadmap (where this issue is listed as part of "Phase 2") and was wondering if there is a meta issue for this somewhere I'm missing. Can we please get a status update?
Thanx in advance.
Comment #9
Dave ReidI think we should promote this to major as it would affect core schema. Not having image dimensions attached to the file entities themselves causes so much more work and additional performance/resources for other modules that need that information, but not in a field-context.
Comment #10
mikeytown2 CreditAttribution: mikeytown2 commentedSorta related as this deals with file I/O on images: #2289493: image_get_info always populates file_size, even if already set.. Also the latest version of https://www.drupal.org/project/imageinfo_cache has an option to cache image_get_info so no file I/O is done; if the linked core patch has been applied.
Comment #11
cilefen CreditAttribution: cilefen commentedComment #12
Dave ReidComment #14
xjmFrom a discussion thread on this issue.
@catch wrote:
@effulgentsia wrote:
@Dave Reid wrote:
Comment #18
vijaycs85In core, we have media source (see Drupal\media\Plugin\media\Source\Image) plugin per type with meta attributes. I believe the issues have been addressed almost close to forecast solutions in #14. Could we close this issue?
Comment #19
vijaycs85Closed? we can open back, if we really have to.