예제 #1
0
 /**
  * Create an object casted array of the featured image in all sizes.
  *
  * @param integer $id The post objects ID
  * @return object|boolean The object casted array or false
  */
 public static function images($id)
 {
     $sizes = self::imageSizes();
     $urls = [];
     if (has_post_thumbnail($id)) {
         $image = wp_get_attachment_image_src(get_post_thumbnail_id($id), 'full');
         $image = pathinfo($image[0]);
         $extension = $image['extension'];
         $image = $image['dirname'] . '/' . $image['filename'];
         $urls['full'] = $image . '.' . $extension;
         foreach ($sizes as $size) {
             $urls[Data::spaceToCamelCase($size->name, '-')] = $image . '-' . $size->width . 'x' . $size->height . '.' . $extension;
         }
         return (object) $urls;
     } else {
         return false;
     }
 }