Closed Mgt03 closed 5 months ago
The metadata mentioned in the documentation are Doctrine metadata, not image metadata. How do you perform the image rotation?
I've open my picture with the default photo app of my computer, and I have rotate the image with it and save it. This action modify the image ['Orientation'] parameter
So does the image have the metadata after this operation? If you try to do a manual image upload with a simple PHP script, do you get the same metadata loss?
Okay, I can describe more with an example. Firstly, I download or I take a picture At this moment, the metadatas of the picture are :
array(7) {
["FileName"]=>
string(11) "classic.jpg"
["FileDateTime"]=>
int(1711023627)
["FileSize"]=>
int(8620)
["FileType"]=>
int(2)
["MimeType"]=>
string(10) "image/jpeg"
["SectionsFound"]=>
string(0) ""
["COMPUTED"]=>
array(4) {
["html"]=>
string(24) "width="244" height="207""
["Height"]=>
int(207)
["Width"]=>
int(244)
["IsColor"]=>
int(1)
}
}
I rotate it with windows and I save it At this moment, the metadatas of the picture are :
array(9) {
["FileName"]=>
string(12) "original.jpg"
["FileDateTime"]=>
int(1711527777)
["FileSize"]=>
int(13668)
["FileType"]=>
int(2)
["MimeType"]=>
string(10) "image/jpeg"
["SectionsFound"]=>
string(24) "ANY_TAG, IFD0, THUMBNAIL"
["COMPUTED"]=>
array(7) {
["html"]=>
string(24) "width="244" height="207""
["Height"]=>
int(207)
["Width"]=>
int(244)
["IsColor"]=>
int(1)
["ByteOrderMotorola"]=>
int(1)
["Thumbnail.FileType"]=>
int(2)
["Thumbnail.MimeType"]=>
string(10) "image/jpeg"
}
["Orientation"]=>
int(3)
["THUMBNAIL"]=>
array(6) {
["Compression"]=>
int(6)
["XResolution"]=>
string(4) "96/1"
["YResolution"]=>
string(4) "96/1"
["ResolutionUnit"]=>
int(2)
["JPEGInterchangeFormat"]=>
int(120)
["JPEGInterchangeFormatLength"]=>
int(4914)
}
}
I upload it in my app with Vich Uploader and the result is : At this moment, the metadatas of the picture are :
array(7) {
["FileName"]=>
string(26) "660412264d5d7087015010.jpg"
["FileDateTime"]=>
int(1711542822)
["FileSize"]=>
int(7072)
["FileType"]=>
int(2)
["MimeType"]=>
string(10) "image/jpeg"
["SectionsFound"]=>
string(0) ""
["COMPUTED"]=>
array(4) {
["html"]=>
string(24) "width="244" height="207""
["Height"]=>
int(207)
["Width"]=>
int(244)
["IsColor"]=>
int(1)
}
}
So, the file is not realy impacted by this modification, but the metadatas change. It seems that VichUploader deletes these metadatas, which has the effect of removing this defined orientation because the image is not originally upside down.
I'm not aware of any metadata handling here. I invite you again to try uploading a file without this bundle and checking the outcome.
I found the origin of my problem, it's on our side, sorry for the inconvenience.
@Mgt03 any hint what it was on your side? Possibly it can help me too.
Hi @bresam, I don't think this is really helpful for you, but this problem was due to an optimization function in my image, where I explicitly remove all metadata from the image I loaded. So no link to the Vich Bundle After deleting this part of my code, it works perfectly.
@Mgt03 Thank you anyway. Found the issue in a Post Upload Event Listener where we did something similar 👍
I need help to use Vich uploader on my project.
My problem concerns the metadata of an image imported from a php form.
I have a form where users can insert images, which are saved after submitting the form. But if they insert an image with a rotation value, after saving, the image loses this value.
I have this configuration in the vich_uploader.yml file:
https://github.com/dustin10/VichUploaderBundle/blob/master/docs/usage.md This documentation show the possibility to add a 'metadata' property but I can't find how to use it after.
My entity is declared as follows :
Concerning the metadata information of the picture before and after, I have this : Picture original :