Login   Register  
PHP Classes
elePHPant
Icontem

File: index.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Roberto Bertó  >  imageFiltersIndex  >  index.php  >  Download  
File: index.php
Role: Example script
Content type: text/plain
Description: An example file that is running at http://opensource.que.com.br/imageFiltersIndex/
Class: imageFiltersIndex
A set of filters that works around the image index
Author: By
Last change: Fixed a typo and the filename
Date: 11 years ago
Size: 2,516 bytes
 

Contents

Class file image Download
<?PHP

   
require "imageFiltersIndex.class.php";

// GD part
   
$img_src_file "825.jpg";
   
$img_src=ImageCreateFromJpeg($img_src_file);

// imageFiltersIndex
   
$imageFiltersIndex = new imageFiltersIndex;
   
$imageFiltersIndex->resource($img_src);

// Only for example reasons
if ($_GET["filterimg"])
{
    if ((!
method_exists($imageFiltersIndex,$_GET["filterimg"]) || $_GET["filterimg"] == "resource"))
    {
        die(
"This filter does not exists");
    }


    
$imageFiltersIndex->$_GET["filterimg"]();

    
header("Content-type: image/jpeg");
    
imagejpeg($img_src,"",50);
}
else
{
print <<<EOF

<html>
<head>
<title>imageFiltersIndex</title>
</head>

<body>
<table width="100%">
<tr valign="top">
<td>

<h1>imageFiltersIndex</h1>
<h2>What is?</h2>
<p>Is a PHP class (<a href="http://www.php.net">http://www.php.net</a>) that contains a set of filters that works around the image index, changing it.</p>
<p>Currently there are 3 filters on it:</p>
<ul>
<li>grayscale:                 Turn an image grayscale [since 1.0]</li>
<li>sepia:                    Turn an image older than it is [since 1.0]</li>
<li>yellowize:                 Add a yellow layer in the front of image (transparent or solid) [since 1.0]</li>
</ul>

<p>You can see more details about this project at <a href="http://darkelder.users.phpclasses.org/browse.html/package/890.html">our project</a> at PHPClasses.org.</p>
<ul>
<li><a href="http://darkelder.users.phpclasses.org/browse.html/package/890.html">Download</a> version 1.1</li>
<li><a href="view.php?f=index.php">View this example source</a></li>
<li><a href="view.php?f=imageFiltersIndex.class.php">View this class source</a></li>
</ul>

<h2>Example</h2>
<p>This is an example only page to imageFiltersIndex.</p>


<h3>Select a filter:</h3>
<ul>
EOF;
    
    foreach(
get_class_methods("imageFiltersIndex") as $filter)
    {
        if (
$filter == "resource") continue;

        
printf('<li><a href="index.php?filter=%s#image">%s</a></li>',$filter,$filter);
    }
}

print <<<EOF

</ul>
EOF;

if (
$_GET["filter"])
{
    
printf('<h3><a name="image">Filter %s</a></h3><img src="index.php?filterimg=%s" />',$_GET["filter"],$_GET["filter"]);
}

print <<<EOF
<h3>Original image:</h3>
<img src="
$img_src_file" />

</td>
<td>
<script type="text/javascript" src="http://darkelder.users.phpclasses.org/browse.html/latest/latest.js"></script>
</td>
</tr>
</table>

</body>
</html>
EOF;

?>