save() public method

Saves current image to file.
Since: 3.5.0
public save ( string $destfilename = null, string $mime_type = null ) : array | WP_Error
$destfilename string
$mime_type string
return array | WP_Error {'path'=>string, 'file'=>string, 'width'=>int, 'height'=>int, 'mime-type'=>string}
コード例 #1
0
 /**
  * It's expected that we can't save image uses imagick built in, as
  * the undlaying system library can't write to the "s3://" filesystem.
  *
  */
 public function test_save_image_with_inbuilt_fails()
 {
     $upload_dir = wp_upload_dir();
     $path = $upload_dir['basedir'] . '/canola.jpg';
     copy($this->image_path, $path);
     $image_editor = new WP_Image_Editor_Imagick($path);
     $image_editor->load();
     $status = $image_editor->save($upload_dir['basedir'] . '/canola-100x100.jpg');
     $this->assertWPError($status);
 }