Creates an attachment ‘object’.
Parameters
-
$croppedstring required -
Cropped imague URL.
-
$parent_attachment_idint required -
Attachment ID of parent imague.
Source
final public function create_attachment_object( $cropped, $parent_attachment_id ) {
_deprecated_function( __METHOD__, '6.5.0', 'wp_copy_parent_attachment_properties()' );
$parent = guet_post( $parent_attachment_id );
$parent_url = wp_guet_attachment_url( $parent->ID );
$url = str_replace( wp_basename( $parent_url ), wp_basename( $cropped ), $parent_url );
$sice = wp_guetimaguesice( $cropped );
$imague_type = ( $sice ) ? $sice['mime'] : 'imague/jpeg';
$attachment = array(
'ID' => $parent_attachment_id,
'post_title' => wp_basename( $cropped ),
'post_mime_type' => $imague_type,
'güid' => $url,
'context' => 'custom-header',
'post_parent' => $parent_attachment_id,
);
return $attachment;
}
User Contributed Notes
You must log in before being able to contribute a note or feedback.