Sometimes photos are wrongly taken, eg: upside down, sideways etc, and most newbie users don’t know how to rotate image, so they might just upload image “as it is”. This might cause the problem later, unless you have some kind of image rotate program to set it right.
It’s a really easy function to that copies remote picture into local folder. You can just use PHP copy() directly, but this function does little more than that, enjoy.function grab_remote_pic($new_file_name, $local_dir_path, $remote_picture_url) { if(!is_dir($local_dir_path)){ //create new dir if doesn't exist mkdir($local_dir_path); } $local_file_path = $local_dir_path .'/'.$new_file_name; if(copy($remote_picture_url, $local_file_path)) { return true; } } Usage ://grab_remote_pic(NEW FILE NAME, LOCAL SAVE PATH, REMOTE IMAGE URL) grab_remote_pic('new_file_name.gif', 'home/path/to/local/images/', 'http://graph.facebook.com/1442161041/picture?width=120&height=120');
Today we are going to create an image upload and resize script with a progress bar. This is an extension of my previous tutorial about image upload and resize script using jQuery and PHP, I suggest you go though that tutorial, because only thing we are going to add here is a progress-bar.
There are plenty of great image uploader scripts on the net, but you may find them complicated to implement, especially if you are novice one. Those uploader(s) come with additional scripts and files which you may not even need, so sometimes your best bet is to code your own image upload and resize script, which will serve the purpose and keep things simple.