Write metadata to WEBP with PHP

Started by ivan2022, October 28, 2022, 08:15:38 AM

Previous topic - Next topic

ivan2022

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
}]

Phil Harvey

I don't know what metadata is shown by file->properties->details.

I think that FAQ 3 applies here.

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

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

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


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.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

ivan2022