Tutorial: How to make an Image Upload and Thumbnailer Script with cURL
First let me tell you a little about what will happen here. PHP has an extension called cURL, standing for client URLS. It allows our webserver to browse other files on the internet, in turn it makes web requests just like our browsers do. The power of cURL however is that it allows us to save and manipulate the information that comes back.
You might want to use cURL to target areas on a website you visit frequent, or setup cron jobs that will email you when a website's content changes. In our case we will use it to grab an image from a website out in internetland bring it back, save it to a temporary folder, thumbnail it, delete the original image (off our server of course) and then show it! How great PHP is. Also for your idea pool is RSS with cURL ![]()
1. What you will firstly need to do is copy the thumb.php file into a new file, rename it to thumbcurl.php interesting name i know. If you haven't done the previous part to this tutorial you can get the file from: thumbstutorial.zip but i recommend that you do the tutorial here.
2. Next open up your thumbcurl.php file and get ready to do some editing. The first thing you will want to do is add the extra input field to the HTML form so that people can enter in their url. My form now looks like:
-
<form name="thumbnail" method="post" enctype="multipart/form-data">
-
File: <input type="file" name="srcimage" /> or
-
-
File URL: <input type="text" name="srcurl" />
-
-
Max Dimensions: <input type="text" name="maxdimensions" /> (optional)
-
-
<input type="submit" name="submit" value="upload" />
-
</form>
Make sure yours does too!

One Response to “Tutorial: How to make an Image Upload and Thumbnailer Script with cURL”
By ghprod
on Aug 17, 2008
Hi … thnx 4 great script