*UPDATE [RESOLVED]**
i just used copy(). suprisingly east :queasy:
i am trying to create a form where the user can specify a path to an image on the web eg.
http://www.education.umd.edu/images/coe2000/sidepict2.jpeg
, and then we save that image to a directory on our server.
Ive been playing around for a while not which the following, but cant seem to get any to work.
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 (".", "IMG");
#$tmpfname = tmpfile();
##-- 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;
}
$im = LoadJPEG ($url_image);
where $url_image is "http://www.education.umd.edu/images/coe2000/sidepict2.jpeg"
$tmpfname = tempnam (".", "IMG");
im guessing this will create a temp file in the current dir?
thanks,
jamie