I have a very simple question regarding wp_get_image_editor (https://codex.wordpress.org/Class_Reference/WP_Image_Editor). I can crop, resize and save an image like this:
$image = wp_get_image_editor( 'example_1.jpg' ); $image->resize( 32, 32, true ); $image->save( $path . '/test.png' ); // Works with jpg/gif/png
It works perfectly. I can convert a JPG file to GIF or PNG (and vice versa), but I don’t seem to be able to conver an image to a .ico file. So a code like:
$image->save( $path . '/test.ico' );
Doesn’t output any image nor any error/notice. So at this point I wonder: can wp_get_image_editor actually convert to .ico files (and if so, how, what am I missing/doing wrong), or it can’t be done?
Thanks in advance!
No. At least I’ve never saw it.
Although I believe that you can tailor some solution. Since WordPress 3.5 in
WP_Image_Editor is added support for Imagick by default (which is a wrapper to the ImageMagick library). You can check
class-wp-image-editor-imagick.php to see how it’s integrated and if you have ImageMagick installed on your server, probably you can tailor something. But I believe it will probably be an overkill for a small set of .ico files.