compatibility with WP Offload S3 plugin
-
Hi,
When using meta slider with cropping, it adds another image to the gallery with the cropped size appended to the file name. The WP Offload S3 plugin does not see this add happening, and therefore does not copy the file to S3. This is solved by going into the gallery and manually copying the file to S3. But there is still another problem – the S3 plugin will only use the new image if it’s in the ‘sizes’ array of _wp_attachment_metadata in the wp_postmeta table. So, what I did was add the following code to metaslider.imagehelper.class.php in the resize_image() function at line 340 just before the return of the URL:
///// $sizes = get_post_meta( $this->id, '_wp_attachment_metadata', true ); unset($saved['path']); $sizes['sizes']["meta-slider-resized-{$dest_size['width']}x{$dest_size['height']}"]=$saved; update_post_meta( $this->id, '_wp_attachment_metadata', $sizes); ///// return $url; }
This is the function that adds the new image to the galley, and also adds the image to the ‘_wp_attachment_backup_sizes’ meta, but, fails to also add it to the ‘sizes’ array of _wp_attachment_metadata in the wp_postmeta table.
I hate modifying plugin code. Would it be possible to add a hook at this location so that we can jump in and do something like this after the new image is added? Or, add the code necessary to add the size of the new image to the sizes array in the meta?
Thank you.
FW
- The topic ‘compatibility with WP Offload S3 plugin’ is closed to new replies.