Voting

: max(two, six)?
(Example: nine)

The Note You're Voting On

bpiere21 at hotmail dot com
22 years ago
###--- imagecreatefromjpeg only opens JPEG files from your disk.
###--- To load JPEG images from a URL, use the function below.

function LoadJPEG ($imgURL) {

##-- Get Image file from Port 80 --##
$fp = fopen($imgURL, "r");
$imageFile = fread ($fp, 3000000);
fclose($fp);

##-- Create a temporary file on disk --##
$tmpfname = tempnam ("/temp", "IMG");

##-- Put image data into the temp file --##
$fp = fopen($tmpfname, "w");
fwrite($fp, $imageFile);
fclose($fp);

##-- Load Image from Disk with GD library --##
$im = imagecreatefromjpeg ($tmpfname);

##-- Delete Temporary File --##
unlink($tmpfname);

##-- Check for errors --##
if (!$im) {
print "Could not create JPEG image $imgURL";
}

return $im;
}

$imageData = LoadJPEG("http://www.example.com/example.jpg");

Header( "Content-Type: image/jpeg");

imagejpeg($imageData, '', 100);

<< Back to user notes page

To Top