[wp-trac] [WordPress Trac] #51665: wp_get_image_editor() ->save stopped creating the directory in 5.6-beta2-49360

WordPress Trac noreply at wordpress.org
Thu Oct 29 21:02:00 UTC 2020


#51665: wp_get_image_editor() ->save stopped creating the directory in
5.6-beta2-49360
-------------------------------+---------------------
 Reporter:  eemitch            |       Owner:  (none)
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  5.6
Component:  Media              |     Version:  trunk
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:
-------------------------------+---------------------

Comment (by eemitch):

 Sure..

 This is a breakdown of my code…


 {{{
 // Define the file path --> .thumbnails does not exist
 $eeThumbsPATH = ABSPATH . $eeSFL_Config['FileListDir'] . $eeDir .
 '.thumbnails/'; // Path to thumbs for this folder


 // Thank WordPress for this easyness.
 $eeFileImage = wp_get_image_editor($eeFileFullPath); // Try to open the
 file

 if (!is_wp_error($eeFileImage)) { // Image File Opened

         $eeFileImage->resize($this->eeFileThumbSize,
 $this->eeFileThumbSize, TRUE); // Create the thumbnail

         $eeFileNameOnly = str_replace('eeScreenshot_', '',
 $eeFileNameOnly); // Strip the temp term from video screenshots

         $eeSFL_Log['SFL'][] = 'Creating Thumb: ' . $eeThumbsPATH .
 'thumb_' . $eeFileNameOnly . '.jpg';

         $eeFileImage->save($eeThumbsPATH . 'thumb_' . $eeFileNameOnly .
 '.jpg'); // Save the file <— THIS NOW FAILS IF .thumbnails/ DOES NOT EXIST

 }
 }}}


 Note that **.thumbnails** is intended to be a hidden folder.

 This works in the 5.5.1, but not the 5.6-beta2-49360

 I’ve added a few line to now detect if **.thumbnails** exists, and create
 if not. So my plugin no longer requires wp_get_image_editor -> save to
 create the directory.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/51665#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list