473,804 Members | 2,123 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP online drawing program

Hi there,

For a very specific service, I have created a PHP script that uses the GD
library functions to create a PNG image from a few lines of XML data
describing a simple diagram/drawing. It's cool and works, writing the XML
data in a text editor is straightforward for me because I designed the
format. I have no idea however how I can make a simple online drawing
program that creates this XML code. The code is realy simple, just storing
things like the start and end coordinates of a line and its color. The
program however should be as intuitive as any simple drawing program: you
should see a line preview while you drag the end point after clicking
created a start point. Multiple undo, several colors, text, rectangle and
circle drawing are pretty much all the requirements.

Can I create such a program using just PHP? Any thoughts on how to make
those live line previews?
Or should I reach for other techniques like JavaScript or Java. Any other
suggestion that works well together with PHP and MySQL? I am still in the
dark here, so any hint or link to a somehow related tutorial is very much
appreciated.

Thanks in advance!
Remon Huijts.
Jul 17 '05 #1
15 13012
On Sun, 14 Dec 2003 21:17:05 +0100, "Remon Huijts" <tr*****@hotmai l.com> wrote:
For a very specific service, I have created a PHP script that uses the GD
library functions to create a PNG image from a few lines of XML data
describing a simple diagram/drawing. It's cool and works, writing the XML
data in a text editor is straightforward for me because I designed the
format. I have no idea however how I can make a simple online drawing
program that creates this XML code. The code is realy simple, just storing
things like the start and end coordinates of a line and its color. The
program however should be as intuitive as any simple drawing program: you
should see a line preview while you drag the end point after clicking
created a start point. Multiple undo, several colors, text, rectangle and
circle drawing are pretty much all the requirements.

Can I create such a program using just PHP? Any thoughts on how to make
those live line previews?
No, because you're asking for actions to be taken in response to client
actions (i.e. moving a mouse). PHP can only react to page requests.
Or should I reach for other techniques like JavaScript or Java. Any other
suggestion that works well together with PHP and MySQL? I am still in the
dark here, so any hint or link to a somehow related tutorial is very much
appreciated.


A Java applet would probably be most suited? Doing this in JavaScript would
probably be possible, but awkward.

--
Andy Hassall (an**@andyh.co. uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Jul 17 '05 #2
"Andy Hassall" <an**@andyh.co. uk> schreef in bericht
news:44******** *************** *********@4ax.c om...
No, because you're asking for actions to be taken in response to client
actions (i.e. moving a mouse). PHP can only react to page requests.

A Java applet would probably be most suited? Doing this in JavaScript would probably be possible, but awkward.


Too bad, I was afraid of that, because my Java knowledge is still limited.
What is the best way for my future Java drawing applet to save the drawings?
The resulting drawing should be editable later, with the same applet, so I
guess drawing information has to be stored in a vector or object oriented
way, not as a bitmap. Right now my drawings are saved as simple XML data
describing the shapes, coordinates and colors, but perhaps other solutions
work better with applets?

Remon Huijts.
Jul 17 '05 #3
"Remon Huijts" a écrit le 15/12/2003 :
Too bad, I was afraid of that, because my Java knowledge is still limited.
What is the best way for my future Java drawing applet to save the drawings?
The resulting drawing should be editable later, with the same applet, so I
guess drawing information has to be stored in a vector or object oriented
way, not as a bitmap. Right now my drawings are saved as simple XML data
describing the shapes, coordinates and colors, but perhaps other solutions
work better with applets?

Remon Huijts.


May be you should consider another structure to answer the client
needs. Actually not everything can be done via PHP or a Web Client. It
is a well known problem, PHP is 'in' nowadays but that doesn't mean you
could do everything with it.
Maybe completely different solution could be better for your needs
(like a separate application for this drawing need).

Keep asking questions, ask other people around you about possible
solutions even strange and choose then.
Good luck to you,
Ben.

--
Have you read the manual?
http://www.php.net/manual/en/

Jul 17 '05 #4
You could of course do this with javascript, but it would be very evil and devil himself would rub his hands seeing you writing such a evil thing ;)

In such a case, i would suggest flash - it is faster, smaller, better-looking and easier to writee than a Java Applet.
--
mfg Christian (Chronial "at" web.de)

--
Composed with Newz Crawler 1.5 http://www.newzcrawler.com/
Jul 17 '05 #5
On Mon, 15 Dec 2003 20:11:10 +0100, "Remon Huijts" <tr*****@hotmai l.com> wrote:
"Andy Hassall" <an**@andyh.co. uk> schreef in bericht
news:44******* *************** **********@4ax. com...
No, because you're asking for actions to be taken in response to client
actions (i.e. moving a mouse). PHP can only react to page requests.

A Java applet would probably be most suited? Doing this in JavaScript
would probably be possible, but awkward.


Too bad, I was afraid of that, because my Java knowledge is still limited.
What is the best way for my future Java drawing applet to save the drawings?
The resulting drawing should be editable later, with the same applet, so I
guess drawing information has to be stored in a vector or object oriented
way, not as a bitmap. Right now my drawings are saved as simple XML data
describing the shapes, coordinates and colors, but perhaps other solutions
work better with applets?


Getting the applet to POST an XML format document back to the PHP script
sounds like a reasonable way to approach it. There's always SVG if you want to
move to a 'standardised' format.

--
Andy Hassall (an**@andyh.co. uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Jul 17 '05 #6
Remon Huijts wrote:

Hi there,

For a very specific service, I have created a PHP script that uses the GD
library functions to create a PNG image from a few lines of XML data
describing a simple diagram/drawing. It's cool and works, writing the XML
data in a text editor is straightforward for me because I designed the
format. I have no idea however how I can make a simple online drawing
program that creates this XML code. The code is realy simple, just storing
things like the start and end coordinates of a line and its color. The
program however should be as intuitive as any simple drawing program: you
should see a line preview while you drag the end point after clicking
created a start point. Multiple undo, several colors, text, rectangle and
circle drawing are pretty much all the requirements.

Can I create such a program using just PHP? Any thoughts on how to make
those live line previews?
Or should I reach for other techniques like JavaScript or Java. Any other
suggestion that works well together with PHP and MySQL? I am still in the
dark here, so any hint or link to a somehow related tutorial is very much
appreciated.


The only thing you couldn't do in PHP/HTML/Javascript is the live line preview.
If you decide you don't need the line preview, you could use a server-side image
map to get your coordinates (ie. the coords of the line to start or the center
of a circle, etc.).

You may also want to consider Flash. It's built-in language (Actionscript) is
pretty good now - you can control almost all aspects of a Flash movie
programatically . You could store your commands in an array and have a "Finish
Button". When that button is pressed it could send the array to your existing
script. This would require creating a whole new script in Actionscript,
though. And the resulting PNG wouldn't look as good as the Flash.

I don't know much about Java, but I imagine you could use that as well.

Regards,
Shawn
--
Shawn Wilson
sh***@glassgian t.com
http://www.glassgiant.com
Jul 17 '05 #7
"Christian Fersch" <Fr********@web .de> schreef in bericht
news:br******** *****@news.t-online.com...
You could of course do this with javascript, but it would be very evil and devil himself would rub his hands seeing you writing such a evil thing ;)

Ghehe, I thought about JavaScript the same way. I saw some very evil
scripts, creating a table cel, div or layer for every pixel. Very dynamic
indeed, but so is the devil. Nevertheless I found some interesting
JavaScript ideas here:
http://www.sru.edu/depts/cisba/comps.../drawlines.htm
In such a case, i would suggest flash - it is faster, smaller,

better-looking and easier to writee than a Java Applet.

Sigh. I know little about Java, but approximately nothing about Flash. Some
newbie questions (if you allow me to post them in this PHP newsgroup):
- Can I have the "line preview while you drag" in a Flash thingie?
- Can a Flash thingie save/output the collected data in a re-editable
format?

Remon Huijts.
Jul 17 '05 #8
"Shawn Wilson" <sh***@glassgia nt.com> schreef in bericht
news:3F******** *******@glassgi ant.com...
You may also want to consider Flash. It's built-in language (Actionscript) is pretty good now - you can control almost all aspects of a Flash movie
programatically . You could store your commands in an array and have a "Finish Button". When that button is pressed it could send the array to your existing script. This would require creating a whole new script in Actionscript,
though. And the resulting PNG wouldn't look as good as the Flash.


You say "the resulting PNG", but can the ActionScript output the final
result in another format that is suitable for re-editing? If for instance I
draw some lines and elipses, but a month later I realize there is one line
too much and a rectangle should be partially behind the elipse, are these
changes possible with ActionScript? Or another way of asking: can
ActionScript read such data?

Remon Huijts.
Jul 17 '05 #9
"Jedi121" <je*********@fr ee.fr.Removethi s> schreef in bericht
news:me******** *************** *********@free. fr.Removethis.. .
May be you should consider another structure to answer the client
needs. Actually not everything can be done via PHP or a Web Client. It
is a well known problem, PHP is 'in' nowadays but that doesn't mean you
could do everything with it.
Maybe completely different solution could be better for your needs
(like a separate application for this drawing need).


Yes I have been considering other solutions, that's why I posted my
question, to ask people what solutions they see fit for my problem. And a
Java applet would be such a separate application as you suggested.

So far I have read these suggestions:
- JavaScript
- Java applet
- Flash / ActionScript

Anyone suggestions or remarks on SVG or MS VML?

Remon Huijts.
Jul 17 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2541
by: Leif K-Brooks | last post by:
I'm considering writing a fairly basic vector drawing program using PyGTK. What's the best way to render it? What I'm thinking of is having everything render on a PIL image, then display that in the GTK window or save it depending on what's being done. Is that the best strategy? Will it be fast enough?
0
2782
by: Tomi Holger Engdahl | last post by:
I am looking for a solution to add on-line drawing tool to a phpBB discussion board. The idea would be that the users can draw their own simple drawings with the tool and attach them easily as images in the discussion. The idea is to easily add small drawings to the postings. The drawign tool should be easy to use and learn. It should be easily integrate to the phpBB system.
2
2555
by: John Baker | last post by:
I find it highly annoying that MS Access tries to go online when I want to look at the help files. Is there a way to configure it so it just looks at my local helpfiles when I hit F1?
0
1337
by: borhan | last post by:
I am designing a program in which the user will be drawing, lines, circules and so on, on a paint control which displays an image opened by the user. "It's like there is a map on the picturebox control and the user draws some raads on the map." I am using System::Drawing::Graphics class, first I assign the handle of the picbox where the user wil draw: graphicsSurface = System::Drawing::Graphics::FromHwnd( picBox->Handle );
2
1357
by: Terry Holland | last post by:
We have an application that is written in VB that allows to users to design some basic structures by allowing them to select items in in a Picture box and them modify the properties of the item that they have selected. The items that they select are generally lines of varying length & thickness & some arrows indicating the position of various forces. The users are very happy with the way they use the program at present, but we would...
2
1437
by: Martin Horn | last post by:
Hi all, I'm adding basic drawing capability to an application that I am writing, and I have been having problems with making the graphics output persist when the application is re-sized,covered etc. This is the solution I have come up with, but it seems a bit convoluted. Before I get too far into the development of the program, could someone cast an eye over my code and tell me if I have approached it in the correct way, or suggest a...
0
3562
by: Hasim AH | last post by:
Hi .. Just getting interested to learn C# and needs help. I want to write C# application so that the program will execute and draw graphics when the user select the drawing menu from the main menu, SigDraw. Here is the codes:- using System; using System.Drawing; using System.Collections;
12
2110
by: pwiegers | last post by:
Yes, I know, this is sort of commercial.. but how else to get people to, what I think, is a handy online applicaton? I created this app because I hate do document :) (Don't we all?) Sometimes I wanted to make a small diagram to depict what a piece of PHP-code does, a database relationship diagram, or, wel... But to do that in ASCII is hard, and not very much fun to do! So, I created this online app that allows you to draw simple diagrams...
5
12881
by: Macias | last post by:
Hi, Please help me, how I can make a line drawing on PictureBox similar to MS paint. I thinking about this: click and hold button, move mouse and relase button. I'm trying useing this g.DrawLine(..), but I have a lot of line. In C++ is a parameter XORPUT, but in C# I can't find it.
0
9715
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10097
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9175
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7642
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6867
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5535
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4313
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3835
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.