PHP Classes

file_finder: Determines if a given image exists and shows it

Recommend this page to a friend!
  Info   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 1,906 All time: 2,065 This week: 191Up
Version License Categories
file_find 1.0GNU General Publi...HTML, Graphics


A class that handles all operations required to check if a pic file exists, calculates appropiate width/height to fit a required area and generates the <img> tag

Picture of Carlos Falo Hervás
Name: Carlos Falo Hervás <contact>
Classes: 10 packages by
Country: Spain Spain
Age: 48
All time rank: 361 in Spain Spain
Week rank: 658 Down20 in Spain Spain Down
Innovation award
Innovation award
Nominee: 1x


===== 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

  Files folder image Files  
File Role Description
Plain text file file_finder_class.php Class Base class file
Accessible without login Plain text file README_EN Doc. Documentation (english)

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:2,065
This week:191Up