Search code examples
phpimagemagickmetadatapsd

Get the metadata of PSD file with PHP


I want to fetch the metadata of a PSD file in PHP with ImageMagick.

I only know how to do this for JPEG or other images types (exif, iptc and so on) but don't know how to read the metadata of a PSD file.

So if you set a comment / copyright in Photoshop and save the PSD, when reading the PSD, the PHP script should be able to read this comment and also some other meta data.

Opening PSD files is already done, so I just want to read these additional metadata.

I use PHP on a managed server with ImageMagick support.

for Javascript I found psd.js https://github.com/noaheverett/psd.js


Solution

  • I saw that you can extract XMP using:

    identify -verbose file
    

    As far as I know PSD is making use of XMP. Additionally there are additional PHP libraries like xmpphptoolkit to deal with metadata specifically.