PHP remote image retrieval: Remote Image proxy program _ PHP Tutorial

Source: Internet
Author: User
PHP remote image retrieval: Remote Image proxy program. Because most virtual hosts have traffic restrictions (especially blog hosts), many choose to store images in free albums such as Flickr and Picasa, after inserting text through external links, because most virtual hosts have traffic restrictions (especially blog hosts), many choose to store images in free albums such as Flickr and Picasa, and then insert it into the article through external links. However, because these websites are often blocked, I suggest you try to put images on your servers.

Because I am very lazy, in case of blog migration, too many attachments will cause trouble for file migration. Therefore, I wrote a remote image proxy program based on the Pika plug-in of cosbeta, in addition, the three graph services Picasa, Flickr, and PhotoBucket used by many blogs are processed to prevent the link from being reset. Click here to download the script.

Usage

In fact, this script works the same way as pika, but since I have made many changes, the usage will be different. Before using it, make sure you have a server that meets the requirements.

  • A large-traffic Foreign php host
  • The server supports curl functions.

If the above requirements are met, you can use this script.

First, upload the script to the root directory of a sub-domain name on a foreign host, and$ Allow_refererAdd a domain name that allows the image to be called. it must contain the domain name of the script and the domain name of your blog. Otherwise, the image cannot be displayed on your blog.

If the image you want to call is a graph bed other than Picasa, Flickr, and PhotoBucket, use the following code (yourdomain is the domain name of the script ):

If you call a Picasa image, use the following code (image_url is the part after "ggpht.com/", and lh * is the first section of the image's external link address, that is, the server number ):

You can call the image of the Flickr and PhotoBucket to change the host parameter to farm * (Flickr) and I *** (PhotoBucket. The reason for this is that the calling methods of these graph beds are so troublesome because the risks of these graph beds being block are relatively high, as long as the domain names of these websites do not appear in the links when the images of these websites are called, the image links will not be reset, so that visitors can see the images when these websites are blocked.

The image is cached to the server after being called using this script. The second call directly calls the cache.

PS

I am making this script a complete WordPress plug-in. if you find that this script is insufficient, please let me know.

Link: http://blog.imbolo.com/php-get-image-from-remote-host/

Ghost (especially the blog host), so many people choose to store images in free albums such as Flickr and Picasa, and then insert them to the text through the external link...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.