notknown7777
notknown7777

Reputation: 419

How to get this specific data about an image

For an import/export tool I need to get specific data about a image, I've got an example, but i dont know how to call this type of array/data. Is there a standard PHP function to get this data or do I have to make my own function?

Example:

a:5:{
    s:5:"width";
    i:1024;
    s:6:"height";
    i:768;
    s:4:"file";
    s:22:"2014/09/Hydrangeas.jpg";
    s:5:"sizes";                
    a:4:{
        s:9:"thumbnail";                    
        a:4:{
            s:4:"file";
            s:22:"Hydrangeas-150x150.jpg";
            s:5:"width";
            i:150;
            s:6:"height";
            i:150;
            s:9:"mime-type";
            s:10:"image/jpeg";
        }
        s:6:"medium";
        a:4:{
            s:4:"file";
            s:22:"Hydrangeas-300x225.jpg";
            s:5:"width";
            i:300;
            s:6:"height";
            i:225;
            s:9:"mime-type";s:10:"image/jpeg";
        }
        s:14:"post-thumbnail";
        a:4:{
            s:4:"file";
            s:22:"Hydrangeas-672x372.jpg";
            s:5:"width";
            i:672;
            s:6:"height";
            i:372;
            s:9:"mime-type";s:10:"image/jpeg";
        }
        s:25:"twentyfourteen-full-width";
        a:4:{
            s:4:"file";
            s:23:"Hydrangeas-1024x576.jpg";
            s:5:"width";
            i:1024;
            s:6:"height";
            i:576;
            s:9:"mime-type";
            s:10:"image/jpeg";
        }
    }
    s:10:"image_meta";
    a:10:{
        s:8:"aperture";
        i:0;
        s:6:"credit";
        s:9:"?????``";
        s:6:"camera";
        s:0:"";
        s:7:"caption";
        s:0:"";
        s:17:"created_timestamp";
        i:1206376913;
        s:9:"copyright";
        s:21:"Microsoft Corporation";
        s:12:"focal_length";
        i:0;
        s:3:"iso";
        i:0;
        s:13:"shutter_speed";
        i:0;
        s:5:"title";
        s:0:"";
    }
}

Above is generated by Wordpress, and I don't know how.

Upvotes: 0

Views: 54

Answers (1)

GHugo
GHugo

Reputation: 2654

This is a serialized array. To transform it to an associative array:

$array = unserialize($your_data);
var_dump($array);

Upvotes: 1

Related Questions