equal
deleted
inserted
replaced
85 public function create_attachment_object( $cropped, $parent_attachment_id ) { |
85 public function create_attachment_object( $cropped, $parent_attachment_id ) { |
86 $parent = get_post( $parent_attachment_id ); |
86 $parent = get_post( $parent_attachment_id ); |
87 $parent_url = wp_get_attachment_url( $parent->ID ); |
87 $parent_url = wp_get_attachment_url( $parent->ID ); |
88 $url = str_replace( wp_basename( $parent_url ), wp_basename( $cropped ), $parent_url ); |
88 $url = str_replace( wp_basename( $parent_url ), wp_basename( $cropped ), $parent_url ); |
89 |
89 |
90 $size = @getimagesize( $cropped ); |
90 $size = wp_getimagesize( $cropped ); |
91 $image_type = ( $size ) ? $size['mime'] : 'image/jpeg'; |
91 $image_type = ( $size ) ? $size['mime'] : 'image/jpeg'; |
92 |
92 |
93 $object = array( |
93 $object = array( |
94 'ID' => $parent_attachment_id, |
94 'ID' => $parent_attachment_id, |
95 'post_title' => wp_basename( $cropped ), |
95 'post_title' => wp_basename( $cropped ), |
214 * |
214 * |
215 * @param null|array|string $value The value get_metadata() should return a single metadata value, or an |
215 * @param null|array|string $value The value get_metadata() should return a single metadata value, or an |
216 * array of values. |
216 * array of values. |
217 * @param int $post_id Post ID. |
217 * @param int $post_id Post ID. |
218 * @param string $meta_key Meta key. |
218 * @param string $meta_key Meta key. |
219 * @param string|array $single Meta value, or an array of values. |
219 * @param bool $single Whether to return only the first value of the specified `$meta_key`. |
220 * @return array|null|string The attachment metadata value, array of values, or null. |
220 * @return array|null|string The attachment metadata value, array of values, or null. |
221 */ |
221 */ |
222 public function get_post_metadata( $value, $post_id, $meta_key, $single ) { |
222 public function get_post_metadata( $value, $post_id, $meta_key, $single ) { |
223 if ( $single && '_wp_attachment_backup_sizes' === $meta_key ) { |
223 if ( $single && '_wp_attachment_backup_sizes' === $meta_key ) { |
224 $site_icon_id = get_option( 'site_icon' ); |
224 $site_icon_id = get_option( 'site_icon' ); |