Changeset 308

Show
Ignore:
Timestamp:
02/25/08 15:19:30 (6 months ago)
Author:
ndory
Message:

Quick Example with comments

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • cleversvg/cleversvg/quick_examples.php

    r307 r308  
    11<?php 
     2//First, require the library call script 
    23require_once('cleversvg.php'); 
    3 header("Content-type: image/svg+xml"); 
    44 
     5//Instanciate a SVG document, specifying its width and height 
    56$doc = new csDocument(550, 300, 'Un document SVG de test'); 
    67 
     8//Then, you can define as many shapes objects as you want and add them to the document 
    79$rect = new csRect(60, 60, 40, 40); 
    810$rect->setFill('red'); 
    911$rect->setStroke('yellow'); 
    1012$rect->setStrokeWidth('4'); 
     13 
    1114$doc->addElement($rect); 
    1215 
     16//Never forget to send image/svg+xml headers before outputing 
     17header("Content-type: image/svg+xml"); 
     18 
     19//When you're done, render the document as a standalone one 
    1320echo $doc->toXML(); 
     21 
     22//Or an embedded one : 
     23//echo $doc->toXML(true); 
    1424?>