Use ‘medium’ size with catch_that_image() function

When the first image is a WordPress image attachment. in 3.6, there is an easier way. function get_first_image_medium_size_url($post_id) { if(!$images = get_attached_images($post_id)) return false; $first_image = current($images); if(!$src = wp_get_attachment_image_src($first_image->ID,’medium’)) return false; $medium_url = current($src); return $medium_url; } get_attached_images is available in 3.6. wp_get_attachment_image_src is available since 2.5.0 which will automatically get or scale the … Read more

Add version query tag to all images

Don’t know why you want to do it when there’s update_post_thumbnail_cache() in WordPress and set expire headers on server side. But you can try this in your functions.php: add_filter(‘wp_get_attachment_image_src’, function($img, $id, $size, $icon) { $img[0] = $img[0] . ‘?v={$some_version}’; return $img; }, PHP_INT_MAX, 4);

Image Quality Thumbnail Compression in WordPress?

(this should be a comment, but my reputation is too low) Setting jpeg_quality will not disable compression because it does not disable processing. JPEGs will be always compressed, and they are almost never lossless, not even at 100 – it does not stand for “100% original quality”. What happens here, is that WordPress’s default image … Read more

Display latest 12 images from media library

Simply omit the parent value. $args = array( ‘post_type’ => ‘attachment’, ‘post_status’ => ‘published’, ‘numberposts’ => 12, ); Check the documentation for other arguments: Function_Reference/get_posts. Maybe you’d like to use the PHP command shuffle, like shuffle( $attachments );.

Generated media have incorrect aspect ratio

Under settings >> media, change the height attributes to 9999, and untick Crop thumbnail to exact dimensions (normally thumbnails are proportional) under the thumbnail size if it is ticked. When you are done, download and install “Force Regenerate Thumbnails”. This is actually better than “Regenerate Thumbnails” as it deletes all redundant image sizes.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)