How To Save Space on Your WordPress Blog Server

February 13th, 2010 By WP Tricks Posted in Tricks

Right now, many blogger uses WordPress for their Publishing platform, I will give some tips how to save space on your WordPress blog server. We will added little bit php code in our functions.php theme files. This code is Automatically uses resized images instead the originals size.

Write code to Automatically uses resized images insteaad the originals below

function replace_uploaded_image($image_data) {
    // if there is no large image : return
    if (!isset($image_data['sizes']['large'])) return $image_data;

    // paths to the uploaded image and the large image
    $upload_dir = wp_upload_dir();
    $uploaded_image_location = $upload_dir['basedir'] . '/' .$image_data['file'];
    $large_image_location = $upload_dir['path'] . '/'.$image_data['sizes']['large']['file'];

    // delete the uploaded image
    unlink($uploaded_image_location);

    // rename the large image
    rename($large_image_location,$uploaded_image_location);

    // update image metadata and return them
    $image_data['width'] = $image_data['sizes']['large']['width'];
    $image_data['height'] = $image_data['sizes']['large']['height'];
    unset($image_data['sizes']['large']);

    return $image_data;
}
add_filter('wp_generate_attachment_metadata','replace_uploaded_image');

This code is doing automatically, so you didn’t needed any command anymore. Thanks for Serge Rauber for tricks about Save Space in WordPress blog server.

Related Posts

  1. Create a Side Blog with WordPress 3.0
  2. Automatically Create a Custom Field

How To Save Space on Your WordPress Blog Server On The NET

How To Save Space on Your WordPress Blog Server # WordPress Tricks ...

Right now, many blogger uses WordPress for their Publishing platform, I will give some tips how to save space on your WordPress blog server. We will added read more

Source: http://wptricks.net/how-to-save-space-on-your-wordpress-blog-server/

5 Ways On How To Save Bandwidth And Space For Your Blogs | SEO ...

... your files and serving them through your blog will save you a lot of space and bandwidth. You also have a plugin in wordpress which will integrate your blog with amazons3 server. read more

Source: http://seoyourblog.com/blogging-tips/5-ways-on-how-to-save-bandwidth-and-space-for-your-blogs-893/

Turn Off Picture Thumbnails in WordPress & Save Web Server Space

When you publish a blog post that has a screenshot or a picture, WordPress will automatically create two image thumbnails in your uploads folder on the web server. Learn how to ... read more

Source: http://www.labnol.org/internet/blogging/turn-off-wordpress-picture-thumbnails/4007/

Automatically # WordPress Tricks & Tips

Right now, many blogger uses WordPress for their Publishing platform, I will give some tips how to save space on your WordPress blog server. We will added little bit php code in ... read more

Source: http://wptricks.net/tag/automatically/

Wordpress

You will get 50mb of disk space on their secure server. You can automate your ... to check the checkbox & save it. You are done. Comment option for all of your WordPress blog posts ... read more

Source: http://www.waveofweb.com/category/wordpress/


Amazing Touch


1 Comments

  1. Where so I put the code so it works



Add Your Comment

Gravatar