PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Carlos Reche   Power Thumb   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example file of how to use PowerThumb class
Class: Power Thumb
Output thumbnail with zoom link and color filters
Author: By
Last change: I made a few corrections in the text.
Date: 20 years ago
Size: 3,651 bytes
 

Contents

Class file image Download
<?php

// Imports PowerThumb Class to this file
require_once 'class.thumb.php';


$Thumb = new PowerThumb();







echo
'<?xml version="1.0" encoding="iso-8859-1" ?>';
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>PowerThumb - Example File</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <style type="text/css">
      body { margin: 70px; font-family: verdana, arial; font-weight: bold; font-size: 15px; }
      img { border: 1px solid #555; }
      hr { width: 600px; text-align: left; color: #aaaaaa; }
      p { margin: 40px 0px; }
    </style>
  </head>
  <body>

    <div style="position: absolute; right: 0px; top: -10px; right: 20px; z-index: -1; text-align: right; font-weight: normal;">
      <div style="font-size: 60px;">
        <span style="letter-spacing: -5px; font-family: arial black; color: #ffbbbb;">Power</span><span style="color: #bbbbff;">Thumb</span>
      </div>
      <div style="font-style: italic; font-size: 15px;">Powered by Carlos Reche</div>
    </div>

    <div style="margin: 30px; font-size: 17px; color: #cc0000;">
      Important!
      <div style="margin: 0px 0px 0px 10px; font-size: 13px; font-weight: normal;">
        To see PowerThumb working please put an image named &quot;photo.jpg&quot; in the same directory of this file.
      </div>
    </div>

    <div style="margin: 30px; font-size: 17px;">
      Features:
      <div style="margin: 0px 0px 0px 10px; font-size: 13px; font-weight: normal;">
        - Create thumbs with ampliations link in a very easy way. There is <br /> no need to have a different HTML document for the popup.<br />
        - Define a description to each picture (will be displayed when ampliated)<br />
        - Seven type of color filters<br />
      </div>
    </div>
<?php

echo "\n<p> Generate thumbs with ampliation link and photo description\n<hr />\n\n";


$Thumb->setDescription("Description goes here. Note that popup size changes automatically to fit each image.");
$Thumb->create('photo.jpg');

$Thumb->setDescription("Another description.");
$Thumb->create('photo.jpg');





echo
"\n</p>\n<p>\n Thumbs in gray scale, personalized tag img style and no ampliation link\n<hr />\n\n";

$Thumb->setAmpliationLink(false);
$Thumb->setFilter("gray");

$Thumb->setStyle("border", "2px dotted red");
$Thumb->create('photo.jpg');

$Thumb->setStyle("border", "2px dashed teal");
$Thumb->create('photo.jpg');




echo
"\n</p>\n<p>\n Thumbs with color filters\n<hr />\n\n";

$Thumb->setAmpliationLink(true);
$Thumb->setStyle("border", "1px solid #000000");
$Thumb->setStyle("margin", "3px");

$Thumb->setFilter('red', 40);
$Thumb->setDescription('Thumb image filter: Red, 40%');
$Thumb->create('photo.jpg');

$Thumb->setFilter('green', 40);
$Thumb->setDescription('Thumb image filter: Green, 40%');
$Thumb->create('photo.jpg');

$Thumb->setFilter('blue', 50);
$Thumb->setDescription('Thumb image filter: Blue, 50%');
$Thumb->create('photo.jpg');

echo
"\n<br />";

$Thumb->setFilter('yellow', 50);
$Thumb->setDescription('Thumb image filter: Yellow, 50%');
$Thumb->create('photo.jpg');

$Thumb->setFilter('magenta', 30);
$Thumb->setDescription('Thumb image filter: Magenta, 30%');
$Thumb->create('photo.jpg');

$Thumb->setFilter('cyan', 50);
$Thumb->setDescription('Thumb image filter: Cyan, 50%');
$Thumb->create('photo.jpg');


echo
"\n</p>";



?>
</body>
</html>