Re: [PHP] Basic question - PHP usage of SVG files [SOLVED]

2007-11-24 Thread tedd

At 1:14 PM +0900 11/24/07, Dave M G wrote:

Larry,

Thanks for your advice.

With the XML editor available within PHP, I've made a small script 
that can extract the point data inside an SVG file, and store them 
as an array of points.


That array can then be used to draw and fill shapes in a PNG image. 
And since they are stored as an array, I can do a little math on 
them to manipulate their scale and whatnot.


The interpolation between points gets lost with this method, but in 
this case, I can get by with straight lines.


Thanks for helping me to see the value in using PHP's XML functions.

--
Dave M G



Dave:

If you want to smooth those points out, you can do it with a bezier 
or catmull spline.


The code for catmull spline can be found here:

http://brlcad.org/doxygen/d7/ddd/rt__dspline_8c-source.html

I would love to see it translated into php.

I have a copy of bezier code in C -- contact me off-list for a copy.

Cheers,

tedd


--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Basic question - PHP usage of SVG files [SOLVED]

2007-11-23 Thread Dave M G

Larry,

Thanks for your advice.

With the XML editor available within PHP, I've made a small script that 
can extract the point data inside an SVG file, and store them as an 
array of points.


That array can then be used to draw and fill shapes in a PNG image. And 
since they are stored as an array, I can do a little math on them to 
manipulate their scale and whatnot.


The interpolation between points gets lost with this method, but in this 
case, I can get by with straight lines.


Thanks for helping me to see the value in using PHP's XML functions.

--
Dave M G

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Basic question - PHP usage of SVG files  [SOLVED]

2007-11-21 Thread Dave M G

Casey,

There is no SVG support in PHP, as far as I know. 


Thank you. That clears things up. I'll just go with PNGs then.

--
Dave M G

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Basic question - PHP usage of SVG files [SOLVED]

2007-11-21 Thread Larry Garfield
On Wednesday 21 November 2007, Dave M G wrote:
 Casey,

  There is no SVG support in PHP, as far as I know.

 Thank you. That clears things up. I'll just go with PNGs then.

I think you missed the point.  SVG is just text.  It's XML.  You can 
manipulate it with SimpleXML or the DOM API functions just as you would any 
other XML file.  It's been a while since I worked with SVG, but I believe you 
can resize an image just by changing an attribute or two.  There's no need 
for SVG support per se, as SimpleXML provides all you need anyway.  That's 
the advantage of XML. :-)

-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it.  -- Thomas 
Jefferson

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Basic question - PHP usage of SVG files

2007-11-21 Thread Dave M G

Larry,

Thank you for responding.


I think you missed the point.  SVG is just text. ... There's no need
for SVG support per se, as SimpleXML provides all you need anyway. 


I did miss the point - thanks for setting me straight.

However, I'm still unsure about using SVGs. On the one hand, what I'm 
using as source files are originally in SVG format and I want to be able 
to dynamically resize and scale them without loss of clarity.


But, after they have been resized and scaled, then I think I need to 
send the resulting image to the browser in some raster image format. 
Indications are that SVG support on browsers is still not as uniform as 
PNG or other raster graphics formats.


At that last step, assuming that I have manipulated the images to my 
satisfaction with SimpleXML, can I then output the result in PNG or JPG 
with PHP?


I'm not so sure this can be done. The tricky part is that I am building 
PHP scripts that could be deployed on servers with different PHP 
settings, so I'm not confident that I can rely on PEAR or ImageMagick 
functions being present. Are they standard on PHP  5?


Forgive me if my questions are clueless to the point of making the 
questions unclear.


--
Dave M G

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Basic question - PHP usage of SVG files

2007-11-21 Thread Larry Garfield
On Wednesday 21 November 2007, Dave M G wrote:
 Larry,

 Thank you for responding.

  I think you missed the point.  SVG is just text. ... There's no need
  for SVG support per se, as SimpleXML provides all you need anyway.

 I did miss the point - thanks for setting me straight.

 However, I'm still unsure about using SVGs. On the one hand, what I'm
 using as source files are originally in SVG format and I want to be able
 to dynamically resize and scale them without loss of clarity.

That sounds like an excellent reason to use SVG for your image manipulation.

 But, after they have been resized and scaled, then I think I need to
 send the resulting image to the browser in some raster image format.
 Indications are that SVG support on browsers is still not as uniform as
 PNG or other raster graphics formats.

Yeah, Firefox is the only browser I know of with native SVG support worth a 
damn.  Konqueror keeps talking about it but I don't know if it's any good 
yet.  Not sure about Opera or Safari.  IE requires a plugin from Adobe, which 
the last time I was playing with it (which has been a while, but there were 
no signs of plans to improve it at the time) was OK, but not great and 
embedded a la flash in a fixed, immutable box.

 At that last step, assuming that I have manipulated the images to my
 satisfaction with SimpleXML, can I then output the result in PNG or JPG
 with PHP?

With native PHP, I don't believe so.  However, I know that there are assorted 
command line tools and Java tools to do so.  I naturally can't think of them 
off the top of my head, but I know they exist.  You could exec() out to 
them 
to cache the rasterized combined image to disk and then serve that.

I don't know off hand if there's a PECL module or some user-space PHP code to 
do that.  It's worth spending 10 min Googling it, though.

 I'm not so sure this can be done. The tricky part is that I am building
 PHP scripts that could be deployed on servers with different PHP
 settings, so I'm not confident that I can rely on PEAR or ImageMagick
 functions being present. Are they standard on PHP  5?

Now that could be a problem.  You'd have to find either some PHP user-space 
library or a CLI C library that you could bundle with the app.  I'm fairly 
certain nothing like that is in stock PHP 5.  As for finding a good such 
library, as I said Google would know better than I.  (Or maybe I should say 
Yahoo, since they use PHP. g)

 Forgive me if my questions are clueless to the point of making the
 questions unclear.

They make a lot more sense now, actually. :-)


-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it.  -- Thomas 
Jefferson

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Basic question - PHP usage of SVG files

2007-11-20 Thread Dave M G

PHP list,

I have some images that are in SVG format. What I want to do with them 
is manipulate them by resizing and overlaying one on top of the other.


I do this frequently with PNG images, and I could first convert these 
images to PNG before manipulating them in PHP.


However, I'd like to preserve line quality by keeping them as SVG until 
the last moment.


I can't see on the online documentation if SVG is supported and if it 
requires different commands than raster image formats.


What is the support for SVG in PHP, and where is the online 
documentation for it?


Thank you for your help.

--
Dave M G

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Basic question - PHP usage of SVG files

2007-11-20 Thread Casey
On Nov 20, 2007 7:24 PM, Dave M G [EMAIL PROTECTED] wrote:
 PHP list,

 I have some images that are in SVG format. What I want to do with them
 is manipulate them by resizing and overlaying one on top of the other.

 I do this frequently with PNG images, and I could first convert these
 images to PNG before manipulating them in PHP.

 However, I'd like to preserve line quality by keeping them as SVG until
 the last moment.

 I can't see on the online documentation if SVG is supported and if it
 requires different commands than raster image formats.

 What is the support for SVG in PHP, and where is the online
 documentation for it?

 Thank you for your help.

 --
 Dave M G

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



There is no SVG support in PHP, as far as I know. However, since SVG's
are XML's, you could extract the contents of svg in both files and
merge them together.

-Casey

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php