PHP Classes


Recommend this page to a friend!
  Classes of Carlos Falo Hervás   file_finder   README_EN   Download  
Role: Documentation
Content type: text/plain
Description: Documentation (english)
Class: file_finder
Determines if a given image exists and shows it
Author: By
Last change: Updating contact information
Date: 16 years ago
Size: 1,759 bytes


Class file image Download
===== BASIC DOCUMENTATION FOR FILE_FINDER CLASS ===== 0.- INTRODUCTION AND EXTENTS I implemented this class due to a necessity on a website where the users could upload pictures and those pictures had to be shown and scaled to fit into general site design... It handles all operations required to determine wether a pic exists (checks for different img types if not specified), scales accordingly to aspect ratio to fit on a fixed space and echoes <img> tag 1.- BASICS OF OPERATION The class works on 2 basic functions PUBLIC INTERFACE: function file_find($imgdir="images") ; The constructor: $imgdir-> string with full path to your web img directory (from WEB ROOT DIR) i.e.: ROOTDIR = "../" (ROOTDIR IS DETERMINED AUTOMATICALLY BY THE CLASS ALWAYS RELATIVE TO CURRENT SCRIPT PATH!!) imgdir = "images" This will mean to get an image you can state "../images" or "/images" Relative path used on file_find ops function get_file($fname,$alttext,$maxw=0,$maxh=0,$altimg) Finds the file and echoes <img> $fname -> the name of the img file (can have .ext or not... if not stated cycles through .gif, .jpg, .png in that order) $alttext -> ALT text for the img tag $maxw -> Max Width for the pic $maxh -> Max Height for the pic $altimg -> Determines substitute for the pic (recursive get_file) useful for a default img i.e. 2.- Future releases and WIP I don't think i'll work much on this class, but any new release will be posted at Any suggestions are wellcome 3.- Contact information Carlos Falo Hervás