[wp-hackers] specific file name for uploaded images - -small.jpg instead of 300x300.jpg
BenderisGreat
greglancaster71 at gmail.com
Fri Apr 18 11:57:37 UTC 2014
I havent tested this, but it appears you can specify a filename yourself
using get_output_format(). Looks to be one of the accepted methods for
wp_get_image_editor().
So maybe something like :
function adams_image_mod( $path, $args ) {
$upload_to = wp_upload_dir();
$img = wp_get_image_editor( $path );
if ( !is_wp_error( $img ) ) {
$rename = $img->get_output_format( 'some-new-name' );
$saved = $img->save();
if($saved) {
wp_update_attachment_metadata( $id, $data );
}
}
}
return $img;
}
I didn't test this, its just an example - but Id imagine that is what the wp
devs put that in for. (make_image() and save() also accept filename args. )
--
View this message in context: http://wordpress-hackers.1065353.n5.nabble.com/specific-file-name-for-uploaded-images-small-jpg-instead-of-300x300-jpg-tp43880p43886.html
Sent from the Wordpress Hackers mailing list archive at Nabble.com.
More information about the wp-hackers
mailing list