Optimise dynamically generated thumbnails?
-
I am using (as an example) a custom block where you provide an image and it generates a thumbnail on save, with rough code along the following lines:
$file = get_attached_file($id); $editor = wp_get_image_editor($file); if ( ! is_wp_error( $editor ) ) { $sizes = $editor->multi_resize(array('newsize'=>array('width'=>240,'height'=>240,'crop'=>true))); $meta['sizes'] = array_merge($meta['sizes'],$sizes); wp_update_attachment_metadata($id,$meta); }I don’t want to use
add_image_sizeand have it generate this size for every single image uploaded to the site, only this specific one.Is there a way to tell LiteSpeed to optimise it, without needing to rescan the entire site manually to look for missing thumbnails?
Could I manually add the image to the litespeed_img_optm table, or is there a function I could call?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Optimise dynamically generated thumbnails?’ is closed to new replies.