PHP Classes

File: example2.php

Recommend this page to a friend!
  Classes of Miguel   pixpic   example2.php   Download  
File: example2.php
Role: Example script
Content type: text/plain
Description: example colors palete
Class: pixpic
Render images in the browser using color DIV tags
Author: By
Last change: example explicir of palete
Date: 8 years ago
Size: 697 bytes
 

Contents

Class file image Download
<?php

include "pixpic.class.php";
$px=new Pixpic();
$img="./elephpant.png";
//Set the image
$px->setImage($img);
//set property zoom =1 original size span=1 not separated
$pro=$px->getProperty();
if(!
$px->error()){
   
$palete=$px->image2palete();
    echo
"<p>Attributes Image:</p>";
    echo
"<p>Width:".$pro[0]."</p>";
    echo
"<p>Height:".$pro[1]."</p>";
    echo
"<p>Bits:".$pro["bits"]."</p>";
    echo
"<p>Type:".$pro["mime"]."</p>";
   echo
"<h1>Paleta</h1>";
   foreach(
$palete as $color)
    echo
"<div style='background-color:#".$color.";width:20px;height:20px;float:left;margin-left:3px;margin-bottom:3px;border:1px solid'></div>";
}else{
    echo
$px->error();
}


?>