JoomGalleryfriends / JG4-dev

Development repository for JoomGallery v4.x
GNU General Public License v3.0
10 stars 6 forks source link

Images - Edit Image - Image Metadata missing #69

Closed AlexanderSupp closed 1 year ago

AlexanderSupp commented 1 year ago

On the way to reconstructing issue #68, I proceeded as follows: Upload a large image. Processing successful.

Screenshot 2023-01-19 165419 Screenshot 2023-01-19 165419

Screenshot 2023-01-19 165449 Screenshot 2023-01-19 165449

Screenshot 2023-01-19 171042 Screenshot 2023-01-19 171042

Copy of the same image using Microsoft File Explorer, Detail View, Detail Area in properties (tags, titles, authors, comments, subject) modified.

Screenshot 2023-01-19 181313 Screenshot 2023-01-19 181313

Modified image uploaded.

Processing complete, but image metadata data is missing.

Screenshot 2023-01-19 170734 Screenshot 2023-01-19 170734

Image metadata controlled with XnViewMP.

Screenshot 2023-01-19 181313 Screenshot 2023-01-19 181313

Screenshot 2023-01-19 172326 Screenshot 2023-01-19 172326

Screenshot 2023-01-19 172755 Screenshot 2023-01-19 172755

Screenshot 2023-01-19 172949 Screenshot 2023-01-19 172949

Screenshot 2023-01-19 173127 Screenshot 2023-01-19 173127

Conclusion: After saving the mentioned properties, Microsoft reduces the file size?!. The EXIF ​​tool provides two warnings (screenshot 2023-01-19 172755). All characteristics are still present, but not in JG4. I can imagine that the error in issue #68 is a subsequent error, which unfortunately I can't reconstruct until now. Therefor I opened this new issue. My original image for testing? Sorry, more than 10 MB.

AlexanderSupp commented 1 year ago

btw. I uploaded both images in JoomGallery 3.6 without any problems.

AlexanderSupp commented 1 year ago

For test, you can download the original image from JoomGallery 3.6 with following links:

https://fotofreunde-much.de/unsere-galerie/galerieansicht/image?view=image&format=raw&type=orig&id=4540

https://fotofreunde-much.de/unsere-galerie/galerieansicht/image?view=image&format=raw&type=orig&id=4541

MrMusic commented 1 year ago

After some tests I can confirm the problem after editing the metadata with windows. First, I made a change to the title and subject in an image using windows 11 explorer. Then I examined the dump of exif_read_data($img, null, 1) in line 998 of IMGtools.php. I found the following:

@AlexanderSupp Try changing line 144 of the file administrator/components/com_joomgallery/src/Service/Uploader/Uploader.php from $data['imgmetadata'] = \json_encode($metadata); to $data['imgmetadata'] = \json_encode($metadata, JSON_INVALID_UTF8_IGNORE);

Then the metadata should be stored again, but with lots of strange characters...

@Elfangor93 What do you think which metadata sections should be stored in which form in the images table? Do you know https://github.com/pel/pel? Maybe it is possible to use it to read the manufacturer-specific tags for example?

AlexanderSupp commented 1 year ago

I changed the source in Uploader.php with the following result. Data from Windows 11 File Explorer: Screenshot 2023-04-24 112215

Data in Image Metadata:

Screenshot 2023-04-24 111928

Screenshot 2023-04-24 112005 Screenshot 2023-04-24 112030

As you see, there are no complete metadata in JG4 like in Win11 File Explorer. I think we must store all metadata like every tool on the market. And then we must decide, which metadata we will use in our processes like Tabs, GPS, Title, Author, and others.

Elfangor93 commented 1 year ago

@MrMusic There is no easy answer for handling metadata. When it comes to the WINXP fields then it could help to follow the instructions from here: https://www.php.net/manual/fr/function.exif-read-data.php#73645 But we will soon find another tool which will not be compatible anymore because many tools are storing metdata in different ways. We will always have strang behavior as long as we stitch to the php default functions (exif_read_data and iptcparse)...

Elfangor93 commented 1 year ago

Possible fix see issue #90