最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

attachments - Attachement Meta DATA

matteradmin7PV0评论

we try to connect our Managment Software to Wordpress / Woocommerce.

Our customers can edit and manage product, stock and category directly from our sofware.

Wordpress Database is simply so we easly reach our goal.

The only problem left is the "Image Management".

Our main problem si the wp_attachment_metadata:

a:5:{s:5:"width";i:910;s:6:"height";i:607;s:4:"file";s:10:"t-logo.jpg";s:5:"sizes";a:15:{s:9:"thumbnail";a:4:{s:4:"file";s:18:"t-logo-300x300.jpg";s:5:"width";i:300;s:6:"height";i:300;s:9:"mime-type";s:10:"image/jpeg";}s:6:"medium";a:4:{s:4:"file";s:18:"t-logo-600x600.jpg";s:5:"width";i:600;s:6:"height";i:600;s:9:"mime-type";s:10:"image/jpeg";}s:12:"medium_large";a:4:{s:4:"file";s:18:"t-logo-768x512.jpg";s:5:"width";i:768;s:6:"height";i:512;s:9:"mime-type";s:10:"image/jpeg";}s:5:"large";a:4:{s:4:"file";s:18:"t-logo-910x448.jpg";s:5:"width";i:910;s:6:"height";i:448;s:9:"mime-type";s:10:"image/jpeg";}s:19:"yith_wcbr_logo_size";a:4:{s:4:"file";s:16:"t-logo-45x30.jpg";s:5:"width";i:45;s:6:"height";i:30;s:9:"mime-type";s:10:"image/jpeg";}s:24:"yith_wcbr_grid_logo_size";a:4:{s:4:"file";s:16:"t-logo-90x60.jpg";s:5:"width";i:90;s:6:"height";i:60;s:9:"mime-type";s:10:"image/jpeg";}s:17:"raworganic-medium";a:4:{s:4:"file";s:18:"t-logo-680x380.jpg";s:5:"width";i:680;s:6:"height";i:380;s:9:"mime-type";s:10:"image/jpeg";}s:15:"raworganic-blog";a:4:{s:4:"file";s:18:"t-logo-680x453.jpg";s:5:"width";i:680;s:6:"height";i:453;s:9:"mime-type";s:10:"image/jpeg";}s:21:"woocommerce_thumbnail";a:5:{s:4:"file";s:18:"t-logo-300x300.jpg";s:5:"width";i:300;s:6:"height";i:300;s:9:"mime-type";s:10:"image/jpeg";s:9:"uncropped";b:1;}s:18:"woocommerce_single";a:4:{s:4:"file";s:18:"t-logo-600x400.jpg";s:5:"width";i:600;s:6:"height";i:400;s:9:"mime-type";s:10:"image/jpeg";}s:29:"woocommerce_gallery_thumbnail";a:4:{s:4:"file";s:18:"t-logo-250x361.jpg";s:5:"width";i:250;s:6:"height";i:361;s:9:"mime-type";s:10:"image/jpeg";}s:12:"shop_catalog";a:4:{s:4:"file";s:18:"t-logo-300x300.jpg";s:5:"width";i:300;s:6:"height";i:300;s:9:"mime-type";s:10:"image/jpeg";}s:11:"shop_single";a:4:{s:4:"file";s:18:"t-logo-600x400.jpg";s:5:"width";i:600;s:6:"height";i:400;s:9:"mime-type";s:10:"image/jpeg";}s:14:"shop_thumbnail";a:4:{s:4:"file";s:18:"t-logo-250x361.jpg";s:5:"width";i:250;s:6:"height";i:361;s:9:"mime-type";s:10:"image/jpeg";}s:14:"shop_magnifier";a:4:{s:4:"file";s:18:"t-logo-600x600.jpg";s:5:"width";i:600;s:6:"height";i:600;s:9:"mime-type";s:10:"image/jpeg";}}s:10:"image_meta";a:12:{s:8:"aperture";s:1:"0";s:6:"credit";s:0:"";s:6:"camera";s:0:"";s:7:"caption";s:0:"";s:17:"created_timestamp";s:1:"0";s:9:"copyright";s:0:"";s:12:"focal_length";s:1:"0";s:3:"iso";s:1:"0";s:13:"shutter_speed";s:1:"0";s:5:"title";s:0:"";s:11:"orientation";s:1:"0";s:8:"keywords";a:0:{}}} 

we are unable to generate this data for the image, because we can't understand these value:

a:5....s:12....s:9

This meta change every images.

You know what this fields stand for?

Thanks

we try to connect our Managment Software to Wordpress / Woocommerce.

Our customers can edit and manage product, stock and category directly from our sofware.

Wordpress Database is simply so we easly reach our goal.

The only problem left is the "Image Management".

Our main problem si the wp_attachment_metadata:

a:5:{s:5:"width";i:910;s:6:"height";i:607;s:4:"file";s:10:"t-logo.jpg";s:5:"sizes";a:15:{s:9:"thumbnail";a:4:{s:4:"file";s:18:"t-logo-300x300.jpg";s:5:"width";i:300;s:6:"height";i:300;s:9:"mime-type";s:10:"image/jpeg";}s:6:"medium";a:4:{s:4:"file";s:18:"t-logo-600x600.jpg";s:5:"width";i:600;s:6:"height";i:600;s:9:"mime-type";s:10:"image/jpeg";}s:12:"medium_large";a:4:{s:4:"file";s:18:"t-logo-768x512.jpg";s:5:"width";i:768;s:6:"height";i:512;s:9:"mime-type";s:10:"image/jpeg";}s:5:"large";a:4:{s:4:"file";s:18:"t-logo-910x448.jpg";s:5:"width";i:910;s:6:"height";i:448;s:9:"mime-type";s:10:"image/jpeg";}s:19:"yith_wcbr_logo_size";a:4:{s:4:"file";s:16:"t-logo-45x30.jpg";s:5:"width";i:45;s:6:"height";i:30;s:9:"mime-type";s:10:"image/jpeg";}s:24:"yith_wcbr_grid_logo_size";a:4:{s:4:"file";s:16:"t-logo-90x60.jpg";s:5:"width";i:90;s:6:"height";i:60;s:9:"mime-type";s:10:"image/jpeg";}s:17:"raworganic-medium";a:4:{s:4:"file";s:18:"t-logo-680x380.jpg";s:5:"width";i:680;s:6:"height";i:380;s:9:"mime-type";s:10:"image/jpeg";}s:15:"raworganic-blog";a:4:{s:4:"file";s:18:"t-logo-680x453.jpg";s:5:"width";i:680;s:6:"height";i:453;s:9:"mime-type";s:10:"image/jpeg";}s:21:"woocommerce_thumbnail";a:5:{s:4:"file";s:18:"t-logo-300x300.jpg";s:5:"width";i:300;s:6:"height";i:300;s:9:"mime-type";s:10:"image/jpeg";s:9:"uncropped";b:1;}s:18:"woocommerce_single";a:4:{s:4:"file";s:18:"t-logo-600x400.jpg";s:5:"width";i:600;s:6:"height";i:400;s:9:"mime-type";s:10:"image/jpeg";}s:29:"woocommerce_gallery_thumbnail";a:4:{s:4:"file";s:18:"t-logo-250x361.jpg";s:5:"width";i:250;s:6:"height";i:361;s:9:"mime-type";s:10:"image/jpeg";}s:12:"shop_catalog";a:4:{s:4:"file";s:18:"t-logo-300x300.jpg";s:5:"width";i:300;s:6:"height";i:300;s:9:"mime-type";s:10:"image/jpeg";}s:11:"shop_single";a:4:{s:4:"file";s:18:"t-logo-600x400.jpg";s:5:"width";i:600;s:6:"height";i:400;s:9:"mime-type";s:10:"image/jpeg";}s:14:"shop_thumbnail";a:4:{s:4:"file";s:18:"t-logo-250x361.jpg";s:5:"width";i:250;s:6:"height";i:361;s:9:"mime-type";s:10:"image/jpeg";}s:14:"shop_magnifier";a:4:{s:4:"file";s:18:"t-logo-600x600.jpg";s:5:"width";i:600;s:6:"height";i:600;s:9:"mime-type";s:10:"image/jpeg";}}s:10:"image_meta";a:12:{s:8:"aperture";s:1:"0";s:6:"credit";s:0:"";s:6:"camera";s:0:"";s:7:"caption";s:0:"";s:17:"created_timestamp";s:1:"0";s:9:"copyright";s:0:"";s:12:"focal_length";s:1:"0";s:3:"iso";s:1:"0";s:13:"shutter_speed";s:1:"0";s:5:"title";s:0:"";s:11:"orientation";s:1:"0";s:8:"keywords";a:0:{}}} 

we are unable to generate this data for the image, because we can't understand these value:

a:5....s:12....s:9

This meta change every images.

You know what this fields stand for?

Thanks

Share Improve this question asked Feb 18, 2019 at 16:45 ADP SoftwareADP Software 1
Add a comment  | 

2 Answers 2

Reset to default 0

That is the attachment's data in serialized format. There's an explanation of the data in the wp_get_attachment_metadata codex entry.

If you have some custom function doing image uploading, you can use wp_generate_attachment_metadata to generate that data.

wp_attachment_metadata contains serialized array. You have to unserialize data to JSON format (for example) and you will know everything ;)

Here is your code in PHP array format:

array (
  'width' => 910,
  'height' => 607,
  'file' => 't-logo.jpg',
  'sizes' => 
  array (
    'thumbnail' => 
    array (
      'file' => 't-logo-300x300.jpg',
      'width' => 300,
      'height' => 300,
      'mime-type' => 'image/jpeg',
    ),
    'medium' => 
    array (
      'file' => 't-logo-600x600.jpg',
      'width' => 600,
      'height' => 600,
      'mime-type' => 'image/jpeg',
    ),
    'medium_large' => 
    array (
      'file' => 't-logo-768x512.jpg',
      'width' => 768,
      'height' => 512,
      'mime-type' => 'image/jpeg',
    ),
    'large' => 
    array (
      'file' => 't-logo-910x448.jpg',
      'width' => 910,
      'height' => 448,
      'mime-type' => 'image/jpeg',
    ),
    'yith_wcbr_logo_size' => 
    array (
      'file' => 't-logo-45x30.jpg',
      'width' => 45,
      'height' => 30,
      'mime-type' => 'image/jpeg',
    ),
    'yith_wcbr_grid_logo_size' => 
    array (
      'file' => 't-logo-90x60.jpg',
      'width' => 90,
      'height' => 60,
      'mime-type' => 'image/jpeg',
    ),
    'raworganic-medium' => 
    array (
      'file' => 't-logo-680x380.jpg',
      'width' => 680,
      'height' => 380,
      'mime-type' => 'image/jpeg',
    ),
    'raworganic-blog' => 
    array (
      'file' => 't-logo-680x453.jpg',
      'width' => 680,
      'height' => 453,
      'mime-type' => 'image/jpeg',
    ),
    'woocommerce_thumbnail' => 
    array (
      'file' => 't-logo-300x300.jpg',
      'width' => 300,
      'height' => 300,
      'mime-type' => 'image/jpeg',
      'uncropped' => true,
    ),
    'woocommerce_single' => 
    array (
      'file' => 't-logo-600x400.jpg',
      'width' => 600,
      'height' => 400,
      'mime-type' => 'image/jpeg',
    ),
    'woocommerce_gallery_thumbnail' => 
    array (
      'file' => 't-logo-250x361.jpg',
      'width' => 250,
      'height' => 361,
      'mime-type' => 'image/jpeg',
    ),
    'shop_catalog' => 
    array (
      'file' => 't-logo-300x300.jpg',
      'width' => 300,
      'height' => 300,
      'mime-type' => 'image/jpeg',
    ),
    'shop_single' => 
    array (
      'file' => 't-logo-600x400.jpg',
      'width' => 600,
      'height' => 400,
      'mime-type' => 'image/jpeg',
    ),
    'shop_thumbnail' => 
    array (
      'file' => 't-logo-250x361.jpg',
      'width' => 250,
      'height' => 361,
      'mime-type' => 'image/jpeg',
    ),
    'shop_magnifier' => 
    array (
      'file' => 't-logo-600x600.jpg',
      'width' => 600,
      'height' => 600,
      'mime-type' => 'image/jpeg',
    ),
  ),
  'image_meta' => 
  array (
    'aperture' => '0',
    'credit' => '',
    'camera' => '',
    'caption' => '',
    'created_timestamp' => '0',
    'copyright' => '',
    'focal_length' => '0',
    'iso' => '0',
    'shutter_speed' => '0',
    'title' => '',
    'orientation' => '0',
    'keywords' => 
    array (
    ),
  ),
);

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far