bookmark_borderCopy image from url to server PHP

As I was working for image module I got opportunity to understand copy image from URL to server. Simple source code will copy remote image and store into server.

But you need consider about the bandwidth and storage capacity of the image which you are trying copy from remote. If you are copying the image from unknown URL, image need to be scanned properly before storing into server.

For us it’s a server to server which is accessible within our organisation, so its a safer side.

Where the script will useful

Script will useful while uploading the image from API side, now a days lots of website providing upload options. If it’s from front end user can browse the image and upload. But in API side it’s not possible for browsing the image in that case user can upload image via the script.

About the script

This script will validate image and upload into server, which have entry log store information about date-time, ip address, file-name and url. Let’s walk through our script. Continue reading “Copy image from url to server PHP”