Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2004
    Location
    Malaysia
    Posts
    29

    Angry Unanswered: problem with GD module

    I have tried calling GD module using a simple cgi script, and it worked. But then, I tried on a more complicated script, where this script processes questions population, it will display characters like below, instead of bar charts.

    PNG  IHDR,hgPLTExftRNS@f 4IDATx][*)Fª;rCU@)LI' f J|Ѕi"%@&@v4h8) g\Vhƒx'V.k{hc]: db@֥%iS'@xpOr +C#(!ZC |HQki>e )w 4.ocG@Z,jG>&0_20)d4L! a  vi6mϯ=D)nuL!a  ShBF2^BpqBdic< 50qv#Qˊ9ٟ8~pfOB^dS#D-Gܷ9TZb{7dM =M$c̛[!NpDY@Y'D)NQ*ޱ ݥocFpz%72L!NB.>ZpmL!aD!H-2aX!+0_VG0N [΍(Āo00IENDB`



    PLEASE HELP.

  2. #2
    Join Date
    Apr 2004
    Location
    Louisville, KY
    Posts
    11
    What is your "Content type" set to? Can you give us a piece of code?

  3. #3
    Join Date
    Mar 2004
    Location
    Malaysia
    Posts
    29

    the codes:

    my @data = (
    ["Day 1","Day 2","Day 3","Day 4","Day 5","Day 6","Day 7","Day 8","Day 9","Day 10"],
    [ 70, 50, 35, 48, 50, 30, 70, 80, 90, 40]
    #[ sort { $a <=> $b } (1, 2, 5, 6) ]
    );

    my $graph = GD::Graph::linespoints->new(400, 300);

    $graph->set(
    x_label => 'Days',
    y_label => 'Marks',
    title => 'Subject : BAHASA MALAYSIA',
    y_min_value => 0,
    y_max_value => 105,
    y_tick_number => 8,
    y_label_skip => 1
    ) or die $graph->error;

    $graph->set_text_clr("green");
    $graph->plot(\@data) or die $graph->error;
    my $format = $graph->export_format;
    print header("image/$format");
    binmode STDOUT;
    print $graph->plot(\@data)->$format();


    i believed the image/format is png...

  4. #4
    Join Date
    Mar 2004
    Location
    Malaysia
    Posts
    29

    Unhappy ???

    so...anyone knows what the problem ?

  5. #5
    Join Date
    Jan 2004
    Location
    Germany
    Posts
    167
    If I remember the header-method correct, it schould be header(-type => "image/$format");

    If that doesn't work, try to hardcode the image/format... Replace $format with png
    board.perl-community.de - The German Perl-Community

  6. #6
    Join Date
    Mar 2004
    Location
    Malaysia
    Posts
    29

    Unhappy ...

    i have tried hardcoded the format by replacing the $format with png, but still cannot work.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •