[wp-trac] [WordPress Trac] #62712: "Edit image" in Media Modal not work for PSD/SVG ( mime_type image/* )

WordPress Trac noreply at wordpress.org
Wed Dec 18 23:54:41 UTC 2024


#62712: "Edit image" in Media Modal not work for PSD/SVG ( mime_type image/* )
-----------------------------+-----------------------------
 Reporter:  Hrohh            |      Owner:  (none)
     Type:  defect (bug)     |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Post Thumbnails  |    Version:  6.7.1
 Severity:  minor            |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 in wp-includes/media-template.php #425
 is a condition for showing "Edit image" button in Media modal attachment
 dialog.
 {{{#!php
 <?php
 <# if ( 'image' === data.type && ! data.uploading && data.sizes &&
 data.can.save ) { #>
 <button type="button" class="button edit-attachment"><?php _e( 'Edit
 Image' ); ?></button>
 <# } else if ( 'pdf' === data.subtype && data.sizes ) { #>
 <p><?php _e( 'Document Preview' ); ?></p>
 ?>
 }}}

 If we have file with metadata sizes, and has mimetype image/*, it will
 show "Edit image" button. So if I add metadata sizes for PSD files, or
 DOCX (like PDF does), it will show  button.


 in wp-admin/includes/media.php #1682
 is a condition for showing "Edit image" button in edit screen.
 {{{#!php
 <?php
 if ( wp_attachment_is_image( $post->ID ) && wp_image_editor_supports(
 array( 'mime_type' => $post->post_mime_type ) ) ) {
 ?>
 }}}

 wp_attachment_is_image function check mime type of file. If is image/*, so
 SVG (image/svg+xml) or PSD (image/vnd.adobe.photoshop), it is true, which
 is ok.

 wp_image_editor_supports check ImageMagick, it has support for mime_type
 of attachment. For PSD return false.

 wp_get_image_editor function for PSD return ImageMagick. I can create jpg.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/62712>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list