Link to home
Start Free TrialLog in
Avatar of winsoftech
winsoftech

asked on

create image on server using php

Send the simple code for create jpeg image on server

iam creating jpeg image on localhost but that code do not run properly on the server
<?php
 
header ("Content-type: image/jpeg");
 
$graph=imagecreate(600,400);
$back_color= imagecolorallocate($graph,150,195,155);
$line_color= imagecolorallocate($graph,10,25,20);
$in_line_color= imagecolorallocate($graph,250,220,250);
$draw_line= imagecolorallocate($graph,140,110,210);
$overs= imagecolorallocate($graph,250,20,10);
$runs= imagecolorallocate($graph,100,110,00);
 
//--------------------horizontal--------------------------//
imageline($graph, 50, 0, 50, 350, $line_color);
 
imageline($graph, 100, 0, 100, 350, $in_line_color);
imageline($graph, 150, 0, 150, 350, $in_line_color);
imageline($graph, 200, 0, 200, 350, $in_line_color);
imageline($graph, 250, 0, 250, 350, $in_line_color);
imageline($graph, 300, 0, 300, 350, $in_line_color);
imageline($graph, 350, 0, 350, 350, $in_line_color);
imageline($graph, 400, 0, 400, 350, $in_line_color);
imageline($graph, 450, 0, 450, 350, $in_line_color);
imageline($graph, 500, 0, 500, 350, $in_line_color);
imageline($graph, 550, 0, 550, 350, $in_line_color);
 
 
imagestring($graph, 100, 100, 350, "hjfghjfhj1",$overs);
 
imagestring($graph, 150, 150, 350, "dsfga2",$overs);
imagestring($graph, 200, 200, 350, "3",$overs);
imagestring($graph, 250, 250, 350, "4",$overs);
imagestring($graph, 300, 300, 350, "sfdgsdf5",$overs);
imagestring($graph, 350, 350, 350, "6",$overs);
imagestring($graph, 400, 400, 350, "sfdasd7",$overs);
imagestring($graph, 450, 450, 350, "8",$overs);
imagestring($graph, 500, 500, 350, "9",$overs);
imagestring($graph, 550, 550, 350, "dafgasdf10",$overs);
 
//-------------------------vertical-------------------------//
 
imageline($graph, 50, 350, 600, 350, $line_color);
imageline($graph, 50, 300, 600, 300, $in_line_color);
imageline($graph, 50, 250, 600, 250, $in_line_color);
imageline($graph, 50, 200, 600, 200, $in_line_color);
imageline($graph, 50, 150, 600, 150, $in_line_color);
imageline($graph, 50, 100, 600, 100, $in_line_color);
imageline($graph, 50, 50, 600, 50, $in_line_color);
 
imagestring($graph, 30, 30, 40, "36",$runs);
imagestring($graph, 30, 30, 90, "30",$runs);
imagestring($graph, 30, 30, 140, "24",$runs);
imagestring($graph, 30, 30, 190, "18",$runs);
imagestring($graph, 30, 30, 240, "12",$runs);
imagestring($graph, 30, 30, 290, "6",$runs);
imagestring($graph, 30, 30, 340, "0",$runs);
//-----------------------------------------------------------------------------------------//
imageline($graph, 50, 350, 100, 300, $draw_line);
imageline($graph, 100, 300, 150, 320, $draw_line);
imageline($graph, 150, 320, 200, 220, $draw_line);
imageline($graph, 200, 220, 250, 290, $draw_line);
imageline($graph, 250, 290, 300, 30, $draw_line);
imageline($graph, 300, 30, 350, 330, $draw_line);
imageline($graph, 350, 330, 400, 130, $draw_line);
imageline($graph, 400, 130, 450, 50, $draw_line);
imageline($graph, 450, 50, 500, 270, $draw_line);
imageline($graph, 500, 270, 550, 179, $draw_line);
 
 
$ii=@imagecreatefromjpeg("pak_run.jpeg");
imagejpeg($graph,$ii,100);
imagedestroy($graph);
?>

Open in new window

Avatar of mostart
mostart

what do you mean by "does not run properly" ? Any error message ?
Avatar of winsoftech

ASKER

No, this is not a err msg

Above code not create any image on the current  folder

i need to create a jpeg image on server


ASKER CERTIFIED SOLUTION
Avatar of StraySod
StraySod
Flag of Czechia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial