0

I am currently using EXIF module to import the DateTimeOriginal tags but it does not display the tag in the form right after uploading the image and I would really prefer to see that info while still filling the form as it affects what I should fill in manually.

I noticed that the image size is displayed next to the image file name after the image has been uploaded, found the code in core/modules/image/image.field.inc that basically hard codes what will be rendered to be sent back to the client in an ajax response. I added a call to exif_read_data() right there and appended my DateTimeOriginal tag after the file size and it works fine!

But surely editing core files is not the right way to do that - there must be some hook to use but I can't seem to figure out which one. Besides I would prefer my tag (and maybe other info like image width and height etc) to be neatly accessible via js on the client to update other fields in the form dependent on it.

I would appreciate any advice on what is the right place to put that code.

0

hook_preprocess_image_widget() worked for me.

  • Hi @Marassa, it is generally ok to answer your own questions, but could you please describe how you have done it? Just a function name does not really help other people with the same problem. Thanks :) – Neograph734 Jul 27 '17 at 9:42
  • My question was very specific - where to put the code, I had no problems with the code itself. Nobody answered here. When I found the answer elsewhere, I posted it here. If you believe you know better what my question was and whether my answer answers my own question, feel free to remove everything ;) – Marassa Jul 28 '17 at 4:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.