FYI developers: A deprecated WP function found in code.
-
Michael, Ben, Jamie, other dev folks.
I noticed the following plugin file includes a deprecated WordPress function: image_resize().
See: https://developer.www.ads-software.com/reference/functions/image_resize/.File: taxonomy-images.php
Line: 172This might be what you want as the replacement code:
<br /> $image_editor = wp_get_image_editor( $path );</p> <p>if ( ! is_wp_error( $image_editor ) ) {</p> <p> // Create a new downsized version of the original image.<br /> $image_editor->resize(<br /> $detail['size'][0], // width<br /> $detail['size'][1], // height<br /> $detail['size'][2] // crop (e.g. true)<br /> );<br /> // Modify the filename to include the image size suffix and save.<br /> $new_path = $image_editor->generate_filename( null, $path );<br /> $image_editor->save( $new_path );</p> <p> // Generate and cache image metadata. Return url.<br /> $meta = wp_generate_attachment_metadata( $id, $path );<br /> wp_update_attachment_metadata( $id, $meta );<br /> $image_intermediate_attrs = image_get_intermediate_size(<br /> $id,<br /> $detail['name']<br /> );</p> <p> if ( isset( $image_intermediate_attrs['url'] ) ) {<br /> return $image_intermediate_attrs['url'];<br /> }<br /> }<br />
If I got this right, I hope this is helpful.
David
- The topic ‘FYI developers: A deprecated WP function found in code.’ is closed to new replies.