New answers tagged

0

Modified for the latest WordPress version. Full guide available here : https://phpbits.net/wordpress-replace-user-uploaded-large-images-automatically/ /* * Remove Original Uploaded images * retain large size image */ add_filter('wp_generate_attachment_metadata','phpbits_replace_uploaded_image'); function phpbits_replace_uploaded_image($image_data) { // ...


1

Unfortunately @Patrick's answer breaks the srcset functions introduced in WP 4.4. Fortunately, we just need to add two additional functions! First, we need to temporarily re-introduce all of the registered thumbnail sizes to the image metadata so they can be considered: function bi_wp_calculate_image_srcset_meta($image_meta, $size_array, $image_src, ...


1

The problem is that you are using functions from GD library to manipulate images, not functions from WordPress Image API (WP_Image_Editor class). So, WordPress things doesn't apply to the generated image by your code. WordPress Image API uses ImageMagick if available, otherwise it uses GD library. In order to keep EXIF data: If GD library is used, you ...


-1

You should not assume that image related metadata survives the wordpress image manipulation. As you found out it depends on the image manipulation library installed on the server, and actually in version 4.5 the aim would be to strip some of it as noted here https://make.wordpress.org/core/2016/03/12/performance-improvements-for-images-in-wordpress-4-5/. If ...



Top 50 recent answers are included