12 Şubat 2012 Pazar

Wordpress'te Resim Yönetimi

Multiple Hostnames

There can also be user improvements by splitting static files between multiple hostnames. Most browser will only make 2 simultaneous requests to a server, so if you page requires 16 files they will be requested 2 at a time. If you spread that between 4 host names they will be requested 8 at a time. This can reduce page loading times for the user, but it can increase server load by creating more simultaneous requests. Also, known is "pipelining" can often saturate the visitor's internet connection if overused.
Offloading images is the easiest and simplest place to start. All images files could be evenly split between three hostnames (assets1.yoursite.com, assets2.yoursite.com, assets3.yoursite.com for example). As traffic grows, these hostnames could be moved to your own server. Note: Avoid picking a hostname at random as this will affect browser caching and result in more traffic and may also create excessive DNS lookups which do carry a performance penalty.
Likewise any static JavaScript and CSS files can be offloaded to separate hostnames or servers.

These junk image files will accumulate at an exponential rate, and over time can really start hogging valuable storage space. Unless you have an explicit reason to keep certain files, you’re better of deleting them and keeping your WordPress house clean and tidy.
If you don’t want to trawl through your server and delete all of these images files manually, you could check out the Additional Image Sizes plugin.

The image bloat solution

Once you’ve cleared out all those unused image files from your server, this a quick and painless solution to stop WordPress from creating them in the first place.

Simply venture into the Settings > Media panel in the left of your WordPress dashboard. Here you can specify the default dimensions of each pre-defined image size: Thumbnail, Medium and Large. By changing the height and width dimensions to zero, you’re telling WordPress not to create the image file.



And that’s all there is to it.
Note: if you’re going to do this, it’s important that you have the correct size image when you initially upload it. If you only use one image size throughout all your posts and pages, you could consider plugging your desired dimensions into the ‘large’ or ‘medium’ image size, and getting rid of the other two.
This will save you the trouble of resizing images before you upload them, but you’ll be left with one extra image file on your server every time.

Change default image  uploading folder in WordPress

This step involves in setting WordPress to change the default uploading folder for the post images. log-in to your WordPress dashboard. Click on

“Miscellaneous”
“Media” under “Settings” from left side of the dashboard.
Fill up the fields as follows: Store uploads in this folder : images Full URL path to files : http://images.yourdomain.com



Update the old post images location

UPDATE wp_posts SET post_content = REPLACE(post_content,'http://www.yourdomain.com/wp-content/uploads/','http://images.yourdomain.com/')

Click on “GO”. This query will replace “http://www.yourdomain.com/wp-content/uploads/”  with “http://images.yourdomain.com/” in all the image location url. To update the images links in the media library run the following sql command

UPDATE wp_posts SET guid = REPLACE(guid,'http://www.yourdomain.com/wp-content/uploads/','http://images.yourdomain.com/')

Redirect the old images link to to subdomain

You have completed all the task with your site and database. But Google has crawled and indexed your old images. So redirect the old image urls to the new image urls to let Google know that those images are same. To do so ad the following line in your .htaccess file 

RedirectMatch 301 ^/wp-content/uploads/(.*)$ http://images.yourdomain.com/$1

Reminder: Backup your .htaccess file before any modification. That’s all to set your subdomain as post-images upload location. Any question is always well come. Put your feedback in the comment section.

Reduce the Size of Images

The load put on servers these days is tremendous with people using lots of images in each article. Reducing the size of images should thus speed up your blog too.One step to do this is to use an image editing software. With this software you can reduce the height and the width of a picture. This is important as this is directly related to the image’s size. If you want a picture to take up the whole width of your content section then go ahead and scale its width down to 500 pixels as this is the usual content section width.

Another step to implement is to use software that actually reduces the size of an image even further. Smush.it is a great web site which decreases the size of a picture to a minimum without reducing its quality.
Now there is also a WordPress plug-in available that will take all these steps automatically. WP Smush.it sounds great and probably is a huge time saver.

Hotlinking Protection

.htaccess file

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?www.siteadınız\.net/ [NC]
RewriteCond %{HTTP_REFERER} !google. [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !search?q=cache [NC]
RewriteCond %{REQUEST_URI} !^/yasak.jpg$
RewriteRule .(gif|jpg|png|mp3|swf)$ /yasak.jpg [NC,L]


Kaynak

Hiç yorum yok:

Yorum Gönder