Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exif get lost during image upload #1175

Closed
rallek opened this issue Dec 12, 2017 · 18 comments
Closed

exif get lost during image upload #1175

rallek opened this issue Dec 12, 2017 · 18 comments

Comments

@rallek
Copy link

rallek commented Dec 12, 2017

Q A
ModuleStudio Version Standalone
Zikula Target in Model ZK1.5
Zikula Version [1.5.3

Expected behavior

the uploaded images should have the exif information of the original image (jpg)

Actual behavior

with shrinking enabled the exif data is not available anymore

Steps to reproduce

upload a jpg with exif information included via a most modul where shrinking is enabled. afterwards download the image from the display page where you opened the file for complete view. Countercheck the exif. They are empty.
If this involves a rather complex scenario maybe attach the .mostapp model file.

@Guite Guite self-assigned this Dec 12, 2017
@Guite Guite added this to the 1.2.0 milestone Dec 12, 2017
@Guite
Copy link
Owner

Guite commented Dec 12, 2017

This is natural. Shrinking means that a thumbnail image is generated which overrides the original one. To keep EXIF data do not use shrinking but enforce maximum dimensions using validation constraints of the upload field instead.

@Guite Guite closed this as completed Dec 12, 2017
@rallek
Copy link
Author

rallek commented Dec 12, 2017

I do not agree. Normally in image rezising in photo software the exif is not deleted.

If I am looking here I do wonder if this is related to my issue:
https://github.com/liip/LiipImagineBundle/blob/2eafba4d25c16655b1e2937a802a1ed5357b5868/Resources/doc/post-processors/jpeg-optim.rst
Find also some information about exif here: liip/LiipImagineBundle#841

There should be a way to keep the exif data inside the image.

@rallek
Copy link
Author

rallek commented Dec 12, 2017

exif is enabled at my shared hosting
grafik

@Guite
Copy link
Owner

Guite commented Dec 12, 2017

The only way to keep EXIF data would be resizing the original image instead of creating a new thumbnail image. But this would cause distortion again if the original image does not meet the destination dimension's ratio.

@Guite Guite modified the milestones: 1.2.0, Future Dec 12, 2017
@Guite
Copy link
Owner

Guite commented Dec 12, 2017

Seems you did not understand my comment above: we are not doing a resize, but create a new thumbnail image which replaces the original image.
If we would do a resize the result would be distorted (German: verzerrt).

@rallek
Copy link
Author

rallek commented Dec 12, 2017

I have not recognized your comment early enough. Now I have updated my question there.

What I do not understand, why a resize is disorting the file.

@Guite
Copy link
Owner

Guite commented Dec 12, 2017

why a resize is disorting the file

Because a resize is a rather "dumb" operation. It does not know adaption modes like INSET or OUTBOUND... it just changes the image's dimensions even if that means the image ratio will be different.

It is similar as if you open a 2000x1000 pixel image in a graphics program and resize it to 500x800.

@Guite
Copy link
Owner

Guite commented Dec 12, 2017

Actually the shrinking was a resize earlier and we recently changed it to thumbnail creation because the images were distorted at your site ;-)

@Guite
Copy link
Owner

Guite commented Dec 12, 2017

As I just wrote at Stack Overflow I could imagine copying EXIF data from the original image to the created thumbnail image - if that is somehow possible.

@rallek
Copy link
Author

rallek commented Dec 12, 2017

mmh, I remember. So my workaround must be a max hight and width. But for this case I should be able to switch off the shrink option.

My target is to have the exif data on the detail view.

@rallek
Copy link
Author

rallek commented Dec 12, 2017

@rallek
Copy link
Author

rallek commented Dec 12, 2017

Why not using relative_resize?
https://github.com/liip/LiipImagineBundle/blob/a109cfdb5c03eac18d265971f301fdea3d26a419/Resources/doc/filters/sizing.rst#relative-resize-options

This would need a modified image setting in the generated modul:
heighten strategy or widen strategy or ratio strategy.
If heighten strategy only the sizes for the height will be use, if widen strategy only the width is used and for ratio inset or outboud will be used including disorting (disorting for inset should be written in the field description).

@Guite
Copy link
Owner

Guite commented Dec 13, 2017

From a conversation with Symfony guys:

I don't think imagine nor the PHP EXIF extension provide a way to write the metadata.

guite: maybe it would be possible to do the other way: use resize() considering INSET or OUTBOUND?

I think if any modifications are done to the image then the EXIF is wiped.

Closing as won't fix. In case somebody comes up with a solution at Stack Overflow I would be willing to reopen though.

@Guite Guite closed this as completed Dec 13, 2017
@Guite Guite modified the milestones: Future, 1.2.0 Dec 13, 2017
@rallek
Copy link
Author

rallek commented Dec 17, 2017

Why not storing the original exif data in the myImageMeta somehow?

@Guite
Copy link
Owner

Guite commented Dec 17, 2017

Worth a try

@Guite Guite reopened this Dec 17, 2017
@Guite Guite modified the milestones: 1.2.0, 1.3.0 Dec 17, 2017
@Guite Guite closed this as completed in 3634f31 Dec 17, 2017
@rallek
Copy link
Author

rallek commented Dec 17, 2017

Great! How to use it in a template?

@Guite
Copy link
Owner

Guite commented Dec 17, 2017

As a start try:

<ul>
{% for fieldName, fieldValue in myEntity.myFieldMeta %}
<li><strong>{{ fieldName }}:</strong> {{ fieldValue }}</li>
{% endfor %}
</ul>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants