Solved

GD - HTML - more than 2 graphs

Posted on 2000-02-28
13
193 Views
Last Modified: 2010-07-27
(please do not forget to read comments from experts and my comments related with their suggestions)
Hi gurus,
i want to make a page that get user's data and according to that data draws 2 different graphics on a new page, also i want to make some comments with the given data. The graphics are directly related  with the user's data.
i am on a point that can accept user's data and draws a graphic. but i can not write any comment as html (not as a part of gif) and draw a new graph.
Any help will be appreciated.
(i can draw one graph at a time but i can not send user's input to 2 perl scripts if i directly call it from html) and when i use img src=cgi-bin/draw.pl  i can not send users data again as different 2 perl scipts.
0
Comment
Question by:camasuvi
  • 8
  • 4
13 Comments
 
LVL 8

Expert Comment

by:shlomoy
ID: 2564134
return the following HTML:

<html><head><title>results!</title></head><body>
<img src="yourGraphicFilename>
your comments here
</body></html>

0
 

Author Comment

by:camasuvi
ID: 2564145
Adjusted points to 47
0
 

Author Comment

by:camasuvi
ID: 2564178
Edited text of question.
0
 
LVL 2

Expert Comment

by:sanek
ID: 2564304
You can call script twice for two different images.
<img src=cgi-bin/draw.pl?draw=picture_1>
<img src=cgi-bin/draw.pl?draw=picture_2>
0
 

Author Comment

by:camasuvi
ID: 2564802
Adjusted points to 130
0
 

Author Comment

by:camasuvi
ID: 2564803
okay let me explain more.
i have prepared an html site that asks starting and finishing dates of an event.
for example 10.02.2000 (starting date )
20.02.2000 are given by user.
my perl script accepts them and prints on the screen.
but i want different graphics for each day. and after each graphic i want to give some info.
since necessary info for each day are stored in oracle database and graphics are drawn according to these stored data
i have to pass them to another perl script and each graphic method should be different for each graphic. (such as pie , bar chart....)
thanks in advance
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

Author Comment

by:camasuvi
ID: 2564805
Edited text of question.
0
 
LVL 2

Expert Comment

by:sanek
ID: 2565080
I don't get it.
You say you have script - draw.pl that
prints desired image. Right?
You say you can use it as follows:
<img src=cgi-bin/draw.pl>  Right?
What I don't understant is why you can't call this script twice from your HTML page. You will pass some additional parameters (graph methods or anything else it needs) as
CGI parameters. If you want text INFO to be dynamic as well, you can write another script, that will receive same parameters as draw.pl and produce relevant text data.
If the problem is to include dynamic text data ino your document, solution will follow.

0
 

Author Comment

by:camasuvi
ID: 2565119
ok the problem is that it is a user-interacted page that i have to use users input as parameter.
if my cgi-script (which uses cgi-lib.pl and for getting users input) write some dynamic text it is ok. but if i call another perl (draw.pl) at the end of the cgi-script (do "draw.pl" it does not put img on the page ( i think because of content types. first one is text/html and other should be image/gif)
The problem is that i do not know which variable should i send to draw.pl since it changes according to users.
0
 
LVL 2

Expert Comment

by:sanek
ID: 2565166
You right when you say it's not going work due content types. Again, I just keep on repeating it, you sould use
<img src=cgi-bin/draw.pl?parameters_that_draw_will_use>
This way image will be requested directly by browser from your draw.pl
draw.pl should be able to parse CGI input, and produce CGI output with appropriate content type. (e.g. print to http header Content-type: image/gif")
Paramteres that are passed to draw.pl tell what user requested graph and how the data should be printed.
The only problem I can see in this system is - security issue. But this also can be solved, if it really matters.
0
 

Author Comment

by:camasuvi
ID: 2565196
ok you can be right at the moment but i have  never used to send parameters in this way draw.pl?parameters_that_draw....    if u expolain me for example how to send two data and how i can get it from perl script i think you deserv all points :))
thanks for your help.
0
 

Author Comment

by:camasuvi
ID: 2565234
ok you can be right at the moment but i have  never used to send parameters in this way draw.pl?parameters_that_draw....    if u expolain me for example how to send two data and how i can get it from perl script i think you deserv all points :))
thanks for your help.
0
 
LVL 2

Accepted Solution

by:
sanek earned 130 total points
ID: 2565293
Ok, so we're going to turn draw.pl to a legal CGI script.

First of all, this is very helpful link, describing CGI.pm - perl library for CGI.
http://stein.cshl.org/WWW/software/CGI/cgi_docs.html

Here how can you use it.
Suppose, you have line
<img src=cgi-bin/draw.pl?user=someuser&type=pi&additional_parameter=if_you_need>

------------------------

#!/usr/bin/perl
# draw.pl - CGI to produce image
use CGI;
$query = new CGI;
$user = $query->param('user') || 'default_user';       # Resolve what equals 'user' in ?user= strnig
$graph_type = $query->param('type') || 'default_type'; # Resolve graph type

print $query->header(-type=>'image/gif',
               -Pragma=>'no-cache',
               -status=>'200 OK',
               -expires=>'now') ;

### print image for $user and depending on $graph_type and exit

--------------------

Your original script, that produces HTML should fill <img src...> with appropriate info.
PS: You can test draw.pl directly from browser window by typing url that used in that <img src=...> tag.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now