How to change _wp_attachment_metadata specific value in SQL?

You could do this via PHP instead of SQL, just get the existing metadata and change what you need to, it will handling the serializing for you: $newwidth=”250″; // or whatever it is $attachments = get_posts(array(‘post_type’=>’attachment’); foreach ($attachments as $attachment) { $id = $attachment->ID; $metadata = wp_get_attachment_metadata($id); $metadata[‘width’] = $newwidth; wp_update_attachment_metadata($id,$metadata); } But really, you … Read more

Can images be automatically compressed?

Use http://wordpress.org/extend/plugins/auto-image-resizer/ Add this to your functions.php: function prune_image_sizes($sizes) { // You can add other size like that for remove those sizes // unset($sizes[‘medium’]); unset($sizes[‘large’]); return $sizes; } add_filter(‘intermediate_image_sizes_advanced’, ‘prune_image_sizes’); Set your large image option to 800px in media options panel. So what did you do? System will not create large size of image but … Read more

Define size for `get_post_gallery_images`, they seem to have been resized to 150×150

If you want get_post_gallery_images to give you full size images, you can use the following: // Use full size gallery images for the next gallery shortcode: add_filter( ‘shortcode_atts_gallery’, ‘wpse_141896_shortcode_atts_gallery’ ); // Your code: $gallery = get_post_gallery_images( $post ); foreach ($gallery as $img) { ?> <li><img src=”https://wordpress.stackexchange.com/questions/141896/<?php echo $img; ?>” /></li> <?php } where /** * … Read more

No srcset for hard-cropped thumbnails

To show a srcset, there must be multiple image sizes of the same aspect ratio. When you set your thumbnail to hard crop without creating any other image sizes you are ensuring that there won’t be a srcset. You might find my answer here helpful. Briefly, in your case, adding this line: add_image_size ( ‘double-size’, … Read more

resize images not crop

Custom Image Sizes Resizing without cropping is already part of the core functionality, via add_image_size(). Note the last parameter: <?php add_image_size( $name, $width, $height, $crop ); ?> The Codex entry describes the $crop parameter as follows: $crop (boolean) (optional) Crop the image or not. False – Soft proportional crop mode ; True – Hard crop … Read more