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

How to disable multiple thumbnail generation?

You can disable the medium and large image sizes by using the ‘intermediate_image_sizes’ filter: function remove_image_sizes($image_sizes){ foreach($image_sizes as $key => $size){ if($size == ‘large’ || $size == ‘medium’) unset($image_sizes[$key]); } return $image_sizes; } add_filter(‘intermediate_image_sizes’, ‘remove_image_sizes’, 12, 1); This skips adding these sizes and the options to insert a medium/large image are left blank in the … Read more

Custom image sizes only for thumbnails

https://github.com/crstauf/WordPress-FeaturedImage-SpecialImageSize try this out; wrote it myself a long time ago. I do have an updated version, coming out soon. let me know if you’ve any questions. as requested, relevant code for functions.php of your theme: // `post_type` => array(width,height,crop) $featimg_sizes = array( ‘post’ => array(50,20,false) ); add_action(‘wp_ajax_set-post-thumbnail’,’generate_featimg_size’,1); function generate_featimg_size() { global $featimg_sizes; $thumbnail_id = … Read more

Add_image_size not cropping

From this comment: Sry, i forgot it, but i want size of 645×445, exactly, and that image dont have it. The width of it is 588px. Look: img201.imageshack.us/img201/4728/40405258.png WordPress need make a zoom on it. WordPress does not zoom. It only crops. If you want an image to have a custom intermediate size, then you … Read more

Detect if image file is a thumbnail

You need to know your site’s current thumbnail dimension settings in order for you to detect if the $url is of thumbnail size. $thumbnail_width = get_option( ‘thumbnail_size_w’ ); $thumbnail_height = get_option( ‘thumbnail_size_h’ ); // The do detection // Assuming you have the image $url $pattern = ‘%’ . $thumbnail_width . ‘x’ . $thumbnail_height . ‘%’; … Read more

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