Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm using an add_image_size(); of 70x70, in a custom theme.

During an ajax request I load a template_part(); with the defined image size, locally all of these images load fine and at the correct dimensions.

When live, though, these images stop being loaded with the correct dimensions and revert to their original size.

So basically I could have a 500x500 image loaded and resized to 70x70, not ideal.

But this only happens live and not locally, I even uploaded the exact same uploads folder to the live site to make sure I wasn't just missing the 70x70 sized images.

Everything is exactly the same theme.

Here's an example link of the local image: http://lart.co.uk/wp-content/uploads/2014/02/1-70x70.png

Then the exact same image on the live site: http://lartmagazine.co.uk/wp-content/uploads/2014/02/1.png

As you can see it's not using the resized image, even though I just literally replaced the live uploads folder with the local one.

I don't understand what's going on.

here's the image code:

<?php 
  $title = get_the_title();
  $attID = get_post_thumbnail_id($post->ID);
  $size = "category-thumb";
  $image = wp_get_attachment_image_src( $attID, $size ); 
      if ( get_the_post_thumbnail() != '' ) { ?> 
    <img alt="<?php echo $title; ?>" title="<?php echo $title; ?>" src="<?php echo $image[0]; ?>"/>
<?php } ?>

and I call this function when I trigger the ajax request:

function side_scroll(){
    $offset = $_POST['offset'];
    $category = $_POST['cat'];
    $args = array('orderby' => 'date','posts_per_page'=>10, 'offset' => $offset, 'orderby' => 'date', 'cat' => $category,'post_status' => 'publish'); 
    $loop = new WP_Query($args);
    while($loop->have_posts()) {
    $loop->the_post(); 
    get_template_part( 'sidebar-posts-template' );
    } wp_reset_postdata();
    die('');
}

and of course the image size:

function add_image_size() { 
    add_image_size( 'large-landscape', 1600, 9999 ); 
    add_image_size( 'gallery', 500, 9999 );
    add_image_size( 'large-portrait', 330, 9999 );
    add_image_size( 'home-thumb', 200, 9999 ); 
    add_image_size( 'category-thumb', 70, 70 ); 
}
share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.