ExifTool Forum

ExifTool => Developers => Topic started by: ivan2022 on October 28, 2022, 08:15:38 AM

Title: Write metadata to WEBP with PHP
Post by: ivan2022 on October 28, 2022, 08:15:38 AM
UPDATE
However i manage to add metadata but now the problem is: after i add metadata and download the file from server machine to my local computer and check file->properties->details, metadata that i added is not there.

Any ideas what im doing wrong ?

output from
shell_exec('/home/mebeguoe/bin/exiftool -json ' . escapeshellarg('/home/user/public_html/image/test.webp') . ' 2>&1');
now is:
[{
  "SourceFile": "/home/user/public_html/image/test.webp",
  "ExifToolVersion": 12.49,
  "FileName": "test.webp",
  "Directory": "/home/user/public_html/image",
  "FileSize": "14 kB",
  "FileModifyDate": "2022:10:28 16:47:40+03:00",
  "FileAccessDate": "2022:10:28 16:47:40+03:00",
  "FileInodeChangeDate": "2022:10:28 16:47:40+03:00",
  "FilePermissions": "-rw-rw-rw-",
  "FileType": "Extended WEBP",
  "FileTypeExtension": "webp",
  "MIMEType": "image/webp",
  "WebP_Flags": "XMP, EXIF",
  "ImageWidth": 1200,
  "ImageHeight": 820,
  "VP8Version": "0 (bicubic reconstruction, normal loop)",
  "HorizontalScale": 0,
  "VerticalScale": 0,
  "ExifByteOrder": "Big-endian (Motorola, MM)",
  "ImageDescription": "example.com",
  "XResolution": 72,
  "YResolution": 72,
  "ResolutionUnit": "inches",
  "Artist": "example.com",
  "YCbCrPositioning": "Centered",
  "Copyright": "example.com",
  "XPAuthor": "example.com",
  "XMPToolkit": "Image::ExifTool 12.49",
  "Caption": "example.com",
  "Creator": "example.com",
  "Description": "example.com",
  "Title": "example.com",
  "Author": "example.com",
  "AuthorsPosition": "example.com",
  "WebStatement": "example.com",
  "ImageSize": "1200x820",
  "Megapixels": 0.984
}]

==========================================================================
==========================================================================
Hello there,

I have simple request to write metadata like: author, copyright.... on webp files that are located on server machine but for some reason i cant manage to add this metadata to the image file

How the command should be writed to write metadata to image ?

this is my code

shell_exec('/home/mebeguoe/bin/exiftool -creator="example.com"' . escapeshellarg('/home/user/public_html/image/test.webp') . ' 2>&1');
$info2 = shell_exec('/home/mebeguoe/bin/exiftool -json ' . escapeshellarg('/home/user/public_html/image/test.webp') . ' 2>&1');
print_r($info2);


output
[{
  "SourceFile": "/home/user/public_html/image/test.webp",
  "ExifToolVersion": 12.49,
  "FileName": "test.webp",
  "Directory": "/home/user/public_html/image",
  "FileSize": "10 kB",
  "FileModifyDate": "2022:10:28 12:51:58+03:00",
  "FileAccessDate": "2022:10:28 12:53:49+03:00",
  "FileInodeChangeDate": "2022:10:28 12:53:37+03:00",
  "FilePermissions": "-rw-r--r--",
  "FileType": "WEBP",
  "FileTypeExtension": "webp",
  "MIMEType": "image/webp",
  "VP8Version": "0 (bicubic reconstruction, normal loop)",
  "ImageWidth": 1200,
  "HorizontalScale": 0,
  "ImageHeight": 820,
  "VerticalScale": 0,
  "ImageSize": "1200x820",
  "Megapixels": 0.984
}]
Title: Re: Write metadata to WEBP with PHP
Post by: Phil Harvey on October 28, 2022, 01:53:43 PM
I don't know what metadata is shown by file->properties->details.

I think that FAQ 3 (https://exiftool.org/faq.html#Q3) applies here.

But my guess might be that Windows doesn't support WebP metadata (I'm assuming that "file->properties->details" is Windows?).

- Phil
Title: Re: Write metadata to WEBP with PHP
Post by: StarGeek on October 28, 2022, 02:32:06 PM
Quote from: Phil Harvey on October 28, 2022, 01:53:43 PMBut my guess might be that Windows doesn't support WebP metadata (I'm assuming that "file->properties->details" is Windows?).

This is the correct answer.

When you look at a file under Properties->Details, if there isn't already an blank entry there, then Windows will not read any of that data.  Here's an example
(https://i.imgur.com/YbQ4jZy.png)

As you can see, the only data there is image size, file name andn path, FileCreateDate/FileModifyDate, file size, and owner.  Windows will not read any other data than this, no matter how hard you try.

If you compare that window to a jpeg file, you'll see there are a lot more details and you can edit them in that window.
(https://i.imgur.com/ZfGSJ0F.png)
Title: Re: Write metadata to WEBP with PHP
Post by: ivan2022 on October 31, 2022, 03:45:19 AM
thanks guys you are the best