Click to See Complete Forum and Search --> : [RESOLVED] get the dir/filename of tmpfile();


knowj
03-29-2008, 08:35 AM
I am using tmpfile() to create a temport file that i can load a blob (jpg/image) into. My issue is how to get the dir/filename of this file so i can use it within the GD image library.

$temp = tmpfile();
fwrite($temp, $row['front_img']);
$image = new image($temp, constants::UPLOADDIR_PRODUCTS);
$thumb = $url.$image->create_image('thumb');

$image = new image($row['front_img'], constants::UPLOADDIR_PRODUCTS);
$img = $url.$image->create_image('normal');

$image = new image($row['front_img'], constants::UPLOADDIR_PRODUCTS);
$detail = $url.$image->create_image('detail');

if ($products->saveimages($row['id'], $thumb, $img, $detail, 'front'))
{
echo 'front saved for '.$row['id']."<br/>\n";
}
fclose($temp); // this removes the file
unset($thumb, $img, $detail);

knowj
03-29-2008, 08:53 AM
I have now used http://uk3.php.net/manual/en/function.tempnam.php which has solved my issue