Support » Fixing WordPress » Size of Thumbnail not getting reduced

  • On my site, i am using post featured image as a 1024X600 size on the home page. But there are only few posts which i will set featured image as.

    For rest of the posts i want to display a thumbnail of medium (or any smaller) size. One solution is picking up the first image and displaying it to the post if no featured image is set.

    But the problem is i cant seem to find a way to compress image. The same size images are being displayed as thumbnails. (When i see the image its the same original size.) How do i compress it to medium (300X200) size?

    Here are the codes i am using.

    function my_image_display($size = 'full') {
    	if (has_post_thumbnail()) {
    		$image_id = get_post_thumbnail_id();
    		$image_url = wp_get_attachment_image_src($image_id, $size);
    		$image_url = $image_url[0];
    	} else {
    		global $post, $posts;
    		$image_url = '';
    		$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
    		$image_url = $matches [1] [0];
    		//Defines a default image
    			$image_url = get_bloginfo('template_url') . "/img/default.jpg";
    	return $image_url;

    and then echoing that my_image_display.

  • The topic ‘Size of Thumbnail not getting reduced’ is closed to new replies.