PHP save picture, how to solve

Source: Internet
Author: User
PHP Save Picture
I use Jpgraph to generate the canvas, enter the canvas, but the picture can not be saved successfully, run the program does not have error prompts.
Draw a line chart with PHP
Include ("e:/phpser/appserv/jpgraph/jpgraph/jpgraph.php");
Include ("e:/phpser/appserv/jpgraph/jpgraph/jpgraph_line.php");
$datay = $pm 25;
$graph = new Graph (700,300, "Auto"); Build Canvas
$graph->img->setmargin (50,40,30,40); Set the margins of the canvas
$graph->img->setantialiasing (); Set the smoothing state of the stitches
$graph->setscale ("Textlin"); Set scale style
$graph->setshadow ();//Create a canvas shadow
$graph->title->set ("Changes in PM2.5 value in the last 24 hours");//Set Caption
$graph->title->setfont (ff_simsun,fs_bold);//Set Title font
$graph->setmargincolor ("LightBlue");//Set the background color of the canvas to be light blue
$graph->yaxis->title->setfont (ff_simsun,fs_bold);//Set the font for the y-axis title
$graph->xaxis->setpos ("min");
$graph->yaxis->hidezerolabel ();
$graph->ygrid->setfill (True,[email protected] ', [email protected] ');
$graph->xaxis->setticklabels ($a);
$graph->xaxis->setfont (Ff_simsun); Set the font for the X axis
$graph->yscale->setgrace (20);
$p 1 = new LinePlot ($datay); Create a Line chart object
$p 1->mark->settype (mark_filledcircle); Set data coordinate points as graphical markers
$p 1->mark->setfillcolor ("Red"); Set the color of the fill
$p 1->mark->setwidth (4); Set the diameter of the cylindrical marker to 4 pixels
$p 1->mark->setcolor ("Blue"); Set the stitch color to Blue
$p 1->setcenter (); Draw stitches at the center of each coordinate point on the x-axis
[color= #FF0000] $graph->add ($p 1); Draw a polyline on a chart
$graph->stroke (); Output image
$graph->stroke (' c:/appserv/www/pm25/1.jpg ');
------to solve the idea----------------------
You
$graph->stroke (); Output image
Do you have a picture displayed?
------to solve the idea----------------------
Do not understand Ah, in learning, refueling it!!
------to solve the idea----------------------
What are the error hints?
is the path to the saved picture writable?

------to solve the idea----------------------
No error, not equal to no error
You can only trace it and see what's wrong.
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.