Login   Register  
PHP Classes
elePHPant
Icontem

File: sample.svg

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Tom Schaefer  >  QTag  >  sample.svg  >  Download  
File: sample.svg
Role: Example script
Content type: text/plain
Description: sample svg
Class: QTag
Generate tag based documents programmatically
Author: By
Last change:
Date: 2008-07-16 12:59
Size: 1,488 bytes
 

Contents

Class file image Download
<?php

header
("Content-Type: image/svg+xml");

echo 
'<?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" 
   "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
'
;

include_once 
'autoload.inc.php';


$rect1 QTag::factory("rect")
        ->
setAttribute("id","black_stripe")
        ->
setAttribute("fill","#000")
        ->
setAttribute("width","5")
        ->
setAttribute("height","1");

$rect2 QTag::factory("rect")
        ->
setAttribute("id","gray_i")
        ->
setAttribute("fill","#444")
        ->
setAttribute("width","5")
        ->
setAttribute("height","1")
        ->
setAttribute("y","1");

$rect3 QTag::factory("rect")
        ->
setAttribute("id","gray_ii")
        ->
setAttribute("fill","#888")
        ->
setAttribute("width","5")
        ->
setAttribute("height","1")
        ->
setAttribute("y","2");

$rect4 QTag::factory("rect")
        ->
setAttribute("id","gray_iii")
        ->
setAttribute("fill","#ccc")
        ->
setAttribute("width","5")
        ->
setAttribute("height","1")
        ->
setAttribute("y","3");

$rect5 QTag::factory("rect")
        ->
setAttribute("id","white")
        ->
setAttribute("fill","#fff")
        ->
setAttribute("width","5")
        ->
setAttribute("height","1")
        ->
setAttribute("y","4");

$svg =     QTag::factory("svg")
        ->
setAttribute("xmlns","http://www.w3.org/2000/svg")
        ->
setAttribute("width","1000")
        ->
setAttribute("height","600")
        ->
setAttribute("viewBox","0 0 5 5")
        ->
add($rect1)
        ->
add($rect2)
        ->
add($rect3)
        ->
add($rect4)
        ->
add($rect5);

echo 
$svg->doRender();