We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
in the cropped image the description, caption and alt metadata ist lost.
find
// Get the filetype $wp_filetype = wp_check_filetype(basename($targetFilePath), null ); $attachment = array(
before this get the date as vars:
$originalFileObject = get_post($id); $originalFileDescription = $originalFileObject->post_content; $originalFileCaption = $originalFileObject->post_excerpt; $originalFileAlt = $originalFileObject->_wp_attachment_image_alt;
the change the array:
$attachment = array( 'guid' => $mediaDir['url'] . '/' . basename($targetFilePath), 'post_mime_type' => $wp_filetype['type'], 'post_title' => preg_replace('/\.[^.]+$/', '', basename($targetFilePath)), 'post_content' => $originalFileDescription, // new! 'post_excerpt' => $originalFileCaption, // new! 'post_status' => 'inherit' );
and after this add the alt to the new file: update_post_meta( $attachmentId, '_wp_attachment_image_alt', $originalFileAlt );
update_post_meta( $attachmentId, '_wp_attachment_image_alt', $originalFileAlt );
The text was updated successfully, but these errors were encountered:
No branches or pull requests
in the cropped image the description, caption and alt metadata ist lost.
find
before this get the date as vars:
the change the array:
and after this add the alt to the new file:
update_post_meta( $attachmentId, '_wp_attachment_image_alt', $originalFileAlt );
The text was updated successfully, but these errors were encountered: