badzv Posted January 24, 2007 Share Posted January 24, 2007 hi guys...got some questions regarding on my script....[code]<?phperror_reporting(0);$w = (int)$_POST['width'];$h = (int)$_POST['height'];$img = imagecreatetruecolor($w, $h);imagefill($img, 0, 0, 0xFFFFFF);$rows = 0;$cols = 0;for($rows = 0; $rows < $h; $rows++){ $c_row = explode(",", $_POST['px' . $rows]); for($cols = 0; $cols < $w; $cols++){ $value = $c_row[$cols]; if($value != ""){ $hex = $value; while(strlen($hex) < 6){ $hex = "0" . $hex; } $r = hexdec(substr($hex, 0, 2)); $g = hexdec(substr($hex, 2, 2)); $b = hexdec(substr($hex, 4, 2)); $test = imagecolorallocate($img, $r, $g, $b); imagesetpixel($img, $cols, $rows, $test); } }}header("Content-type:image/jpeg");imagejpeg($img, "", 95);?>[/code]...as you can see, the image comes from a POST variables. the problem here is that the image could be viewed but its not on the server. could somebody help me please how to make that image thats been generated with my php script to be on the server already? upon generated, it would be on the server already.thank you very much! Link to comment https://forums.phpfreaks.com/topic/35561-imagejpg-question/ Share on other sites More sharing options...
badzv Posted January 24, 2007 Author Share Posted January 24, 2007 anyone??? please!!!!!!!!! Link to comment https://forums.phpfreaks.com/topic/35561-imagejpg-question/#findComment-168385 Share on other sites More sharing options...
Miichael Posted January 24, 2007 Share Posted January 24, 2007 Your question is not real clear. By being on the server already do you mean save it to the server as a file?If so, I got the following from HuggieBear in response to a question I posed. This may not be the question you are asking. If you are talking about how to get the image into a html page, well, I'm struggling with that also.imagejpeg($im);orimagejpeg($im, null, 100);By changing, or adding the second parameter, you can save the image.$filename = '/home/domains/domain.co.uk/images/dynamic.jpg';imagejpeg($im, $filename, 100);RegardsHuggie Link to comment https://forums.phpfreaks.com/topic/35561-imagejpg-question/#findComment-168477 Share on other sites More sharing options...
badzv Posted January 24, 2007 Author Share Posted January 24, 2007 thank you...that last line of yours work...thanks! Link to comment https://forums.phpfreaks.com/topic/35561-imagejpg-question/#findComment-168530 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.