PHP Classes

File: exe.php

Recommend this page to a friend!
  Classes of Sebastian R÷bke  >  Boosty's ASCII Artist  >  exe.php  >  Download  
File: exe.php
Role: Example script
Content type: text/plain
Description: Example script called by index.html
Class: Boosty's ASCII Artist
Converts images into some kind of ASCII Art
Author: By
Last change: - Updated to be used with the latest ASCIIArtist class version
- Added comments
Date: 18 years ago
Size: 2,488 bytes


Class file image Download
// Boosty's ASCIIArtist (
// exe.php
// This script is called by the settings form (index.html)
// and starts the ASCIIArtist accordingly

// Load ASCIIArtist class file
require ('ASCIIArtist.php');
    <title>Boosty's ASCIIArtist</title>
<div align="center">
// Image location submitted?
if (empty($_REQUEST['image'])) {
'<p style="font-family: Verdana, sans-serif; font-size: 11px;">Error: No image location specified.</p>';
} else {
// OK, let's get it on!
    // Create an ASCIIArtist object
$ASCIIArtist = &new ASCIIArtist;
// Set the given image file location (will return false if an error occurs)
if (!$ASCIIArtist->setFile($_REQUEST['image'])) {
// An error occured!
echo $ASCIIArtist->getHTMLErrors();
    } else {
// Flip horizontally?
if ($_REQUEST['flip_h']) {
$flip_h = true;
        } else {
$flip_h = false;
// Flip vertically?
if ($_REQUEST['flip_v']) {
$flip_v = true;
        } else {
$flip_v = false;
// Set the CSS as desired
            color : '
            background-color: transparent;
            font-size : '
            font-family : "Courier New", Courier, mono;
            line-height : '
            letter-spacing : "
// Convert the image
$ASCIIArtist->renderHTMLImage($_REQUEST['mode'], $_REQUEST['resolution'], $_REQUEST['fixed_char'], $flip_h, $flip_v);
// Print converted image as HTML
echo $ASCIIArtist->getHTMLImage();
// Show the original image aswell
echo '<br><p style="font-family: Verdana, sans-serif; font-size: 11px;">Original Image:<br><img src="'.$_REQUEST['image'].'" height="'.$ASCIIArtist->getImageHeight().'" width="'.$ASCIIArtist->getImageWidth().'" alt="'.$_REQUEST['image'].', '.$ASCIIArtist->getImageWidth().' x '.$ASCIIArtist->getImageHeight().' px"></p>';
<p style="font-family: Verdana, sans-serif; font-size: 11px;">Powered by <a href="">Boosty's ASCIIArtist</a></p>

For more information send a message to info at phpclasses dot org.