File/functions.inc.php

Description

Aptana Cloud Sample Application - Image Manipulation Demo Functions

This file contains all the function definitions for the sample application.

Constants
SITE_ROOT = dirname(__FILE__).'/' (line 17)

The document site root

Variables
array $valid_files (line 25)

Valid file extensions for uploaded images

  • name: $valid_files
Functions
generatePolaroidImage (line 102)

Generates a "Polaroid" of an Image

This function will take an image file, scale it down to no wider than 450 pixels, rotate it randomly, and then apply a "polaroid" type effect to it with a drop-shadow. It then returns the manipulated file name.

Because of the effects applied during the manipulation, the returned file is always a PNG image (for transparency support).

  • return: The name of the resultant file
string generatePolaroidImage (string $filename)
  • string $filename: Full filesystem path to the image to manipulate
getFileExtension (line 134)

Returns the Extension of a File

  • return: The extension of the file
string getFileExtension (string $filename)
  • string $filename: The full path to the file to get the extension of
uploadImage (line 47)

Uploads an Image to the Uploads Folder

This function is pretty straight-forward. It does a few simple things:

  • Attempts to chmod the uploads directory to make sure it is writeable
  • Sanitizes the uploaded file name
  • Uploads the file
  • Makes sure that the file is a valid image type
It will return an array with the following fields:

  • filename: the sanitized name of the uploaded file
  • success: true / false
  • error: the reason the upload failed (if success == false)

  • return: The result of the upload
array uploadImage (string $key)
  • string $key: The form uploader element to use for the upload

Documentation generated on Tue, 07 Oct 2008 15:23:01 -0700 by phpDocumentor 1.4.2