How To Save Space on Your WordPress Blog Server


Sponsored Links




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.

Subscribe to Full RSS Feed

RSS FeedIf you thing this article useful, please consider subscribing to our RSS Feed or e-mail updates and stay updated with us. You can also follow @WPTricksNet on twitter for latest updates.

About WP Tricks

We are WordPress Family, we collected and writed useful tips and tricks for you WordPress. We share it for you...

Related Tips and Trick from Local Data and on The Net

WordPress › Blog Tool, Publishing Platform, and CMS

WordPress is web software you can use to create a beautiful website or blog. We like to say that WordPress is both free and priceless at the same time. Read More

WordPress Backups « WordPress Codex

Your WordPress database contains every post, every comment and every link you have on your blog. up your WordPress database for various server file to save space Read More

WordPress.com — Get a Free Blog Here

Free blogs managed by the developers of the WordPress software. Includes custom design templates, integrated statistics, automatic spam protection and other features. Read More

Importing Content « WordPress Codex

the limit; if you do not (your WordPress installation is hosted on a shared server Live Space (MSN Space) Live Space Textpattern CMS posts into your WordPress blog is Read More

WordPress Website Hosting l Coupon Codes and Reviews

Unlimited Disk Space; Latest Versions of WordPress Installed can have your very own self-hosted WordPress blog with your from Host Gator and Green Geeks to save Read More


One Response to How To Save Space on Your WordPress Blog Server

  1. Tech support says:

    Where so I put the code so it works

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>