set_quality($quality); if ( is_wp_error( $editor->resize( $width, $height, $crop ) ) ) return false; $resized_file = $editor->save(); if(!is_wp_error($resized_file)) { $resized_rel_path = str_replace( $upload_dir, '', $resized_file['path']); $img_url = $upload_url . $resized_rel_path; } else { return false; } } else { $resized_img_path = image_resize( $img_path, $width, $height, $crop, null, null, $quality ); if(!is_wp_error($resized_img_path)) { $resized_rel_path = str_replace( $upload_dir, '', $resized_img_path); $img_url = $upload_url . $resized_rel_path; } else { return false; } } } //return the output if($single) { //str return $image = $img_url; } else { //array return $image = array ( 0 => $img_url, 1 => $dst_w, 2 => $dst_h ); } return set_url_scheme( $image ); }