php images
Posted: Mon Apr 10, 2006 5:22 am
Pimptastic | Please use
Pimptastic | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi
I am trying to manipulate a JPEG and save it in another name.
It shouts : imagejpeg(): Unable to open for writing .
What is wrong?
Thanks
Dan.
This is the code:Code: Select all
<?php
include "../init_page.php";
$sql=" SELECT * FROM items";
$result = mysql_query($sql) or die(mysql_error());
while ($row = mysql_fetch_array($result))
{
$pixels=$row['pixels'];
$folder=$_SESSION['adminsiteaddress'];
$picname=$row['picture'];
$tempname=$folder."temp_".$picname;
echo $folder." ".$tempname;
$image = imagecreatefromjpeg($folder.$picname);
//$image=imagecreatefromjpeg($picname);
$x = imagesx($image); // image size x
$y = imagesy($image); // image size y
$x1=round($x/4); //number of x pixels
$y1=round($x1/2); //number of y pixels
$gridW=abs($x/$x1);
$gridH=abs($y/$y1);
// grayscale some pixels image
$temp=0;
$xx=0;
$yy=0;
$i=0;
if ($calc==1)
while ($i<$x1*($y1+1))
{
$xx++;
if ($xx*$gridW>$x){$xx=0;$yy++;}
if ($i>$pixels) grayPixel($xx,$yy);
$i++;
}
imagejpeg($image,$tempname);
//imagejpeg($image, null, 100);
imagedestroy($image);
}
?>Pimptastic | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]