Wednesday 30 January 2013

Tomthumb script not working on Heartinternet Servers

After my last blog Slider Images not Showing on Responsive Creative Wordpress Theme  I've realised that this may because of a wider issue that is due to the Tomthumb script not working on Heart Internet servers.  ( although I'm not 100% sure of this fact )  . 

My issue this time is with the Gallery I'm using on the theme Midway Responsive and the specific issue is with the thumbnails showing .

This theme uses timthumb.php  to do the reduction; I also tried the plugin 'thumbGen' but that produced no success either.

No I noticed that in the 'uploads' folder I already had different sized images made of the images I was trying to show.  So I've written a function to call up one of those smaller sizes and will change the width inside the 'img' tag. 

here's my changes

OPEN

wp-content/themes/midway/template-gallery.php

FIND

echo themex_thumbnail($post->ID,460,intval($height));

REPLACE WITH

echo lrip_gallery_thumbnail($post->ID);

SAVE


OPEN

wp-content/themes/midway/framework/functions.php




AT THE BOTTOM OF THE PAGE BEFORE THE ? >  ADD


// Gallery Thumbnail issue ( heart related ) hack

function lrip_gallery_thumbnail($ID){
    global $blog_id;
    $src = wp_get_attachment_url( get_post_thumbnail_id($ID) );
// going to explode using .jpg and fix on a new ending
    $img_url_array = explode('.jpg', $src);
    $img_url = $img_url_array[0].'-300x225.jpg';
    return $img_url;
}


SAVE AND UPLOAD







No comments: