XML_svg2image
[ class tree: XML_svg2image ] [ index: XML_svg2image ] [ all elements ]

Class: XML_svg2image

Source Location: /XML_svg2image-0.2.0/XML/svg2image.php

Class Overview


SVG to image converter.


Author(s):

Copyright:

  • 1997-2003 The PHP Group

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 41]
SVG to image converter.

see README.svg2image for details, examples and warnings ;)



[ Top ]


Class Variables

$contenttype =  "image/png"

[line 86]

the content-type to be sent if printimage is called.

Type:   contenttype


[ Top ]

$image =  ""

[line 55]

image-file used in this class

Type:   string


[ Top ]

$imageHeight =  false

[line 102]

the height of the output image, if not set, default values are taken

Type:   imageHeight


[ Top ]

$imageQuality =  0.8

[line 110]

the quality of the output image, makes only sense with jpegs

Type:   imageQuality


[ Top ]

$imageWidth =  false

[line 94]

the width of the output image, if not set, default values are taken

Type:   imageWidth


[ Top ]

$renderer =  "png"

[line 78]

the render Type. At the moment (batik 1.0), possible values are
  • png
  • jpeg


Type:   string


[ Top ]

$svg =  ""

[line 48]

xsl-file used in this class

Type:   string


[ Top ]

$tmpdir =  "/tmp"

[line 62]

Where the temporary xsl and image files should be stored

Type:   string


[ Top ]

$tmpimageprefix =  "svg"

[line 69]

A prefix for the temporary files

Type:   string


[ Top ]



Method Detail

deleteImage   [line 278]

void deleteImage( [string $image = ""])

Deletes the created image

If you dynamically create images and you store them for example in a Cache, you don't need it afterwards. If no image is given, the one generated in run() is deleted

  • Access: public

Parameters:

string   $image   —  file output image-file

[ Top ]

deleteSvg   [line 297]

void deleteSvg( [string $svg = ""])

Deletes the created svg

If you dynamically create svgs, you don't need it afterwards. If no svg-file is given, the one generated in run() is deleted


Parameters:

string   $svg   —  file input svg-file

[ Top ]

printImage   [line 319]

void printImage( [string $image = ""])

Prints the content header and the generated image to the output

If you want to dynamically generate images and return them directly to the browser, use this. If no image-file is given, the generated from run() is taken.

  • See: returnimage()
  • Access: public

Parameters:

string   $image   —  file output image-file

[ Top ]

returnImage   [line 339]

string returnImage( [string $image = ""])

Returns the image

If no image-file is given, the generated from run() is taken.


Parameters:

string   $image   —  file output image-file

[ Top ]

run   [line 128]

bool run( string $svg, [string $image = ""], [boolean $delSvg = false])

Calls the Main Batik-Transcoder-Java-Programm

One has to pass an input svg-file and if the image should be stored permanently, a filename/path for the image. if the image is not passed or empty/false, a temporary image-file will be created


Parameters:

string   $svg   —  file input svg-file
string   $image   —  file output image-file
boolean   $delSvg   —  if the svg should be deleted after execution

[ Top ]

runFromFile   [line 261]

bool runFromFile( string $svg, [string $image = ""])

A wrapper to run for better readabilty

This method just calls run....


Parameters:

string   $svg   —  svg input svg-string
string   $image   —  file output image-file

[ Top ]

runFromString   [line 238]

bool runFromString( string $svgstring, [string $image = ""])

If the svg is a string, not a file, use this.

If you generate the svg dynamically (for example with a xsl-stylesheet), you can use this method

The Batik-Java program needs a file as an input, so a temporary svg-file is created here (and will be deleted in the run() function.)


Parameters:

string   $svgstring   —  svg input svg-string
string   $image   —  file output image-file

[ Top ]

setContentType   [line 388]

void setContentType( [string $contenttype = "image/png"])

sets the content-type

Parameters:

string   $contenttype   —  the content-type for the http-header

[ Top ]

setImageHeight   [line 416]

void setImageHeight( string $height)

sets the height of the output image
  • See: $setImageHeight
  • Access: public

Parameters:

string   $height   —  the height of the image in pixel

[ Top ]

setImageQuality   [line 430]

void setImageQuality( string $quality)

sets the quality of the output image
  • See: $setImageQuality
  • Access: public

Parameters:

string   $quality   —  the quality of the image in percent (max = 1 min = 0)

[ Top ]

setImageWidth   [line 402]

void setImageWidth( string $width)

sets the width of the output image
  • See: $setImageWidth
  • Access: public

Parameters:

string   $width   —  the width of the image in pixel

[ Top ]

setRenderer   [line 364]

void setRenderer( [string $renderer = "png"], [string $overwriteContentType = true])

sets the rendertype
  • See: $this-renderer
  • Access: public

Parameters:

string   $renderer   —  the type of renderer which should be used
string   $overwriteContentType   —  if the contentType should be set to a approptiate one

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:39:14 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.