PHP Classes

file_finder: Determines if a given image exists and shows it

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

Author

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: 49
All time rank: 361 in Spain Spain
Week rank: 215 Down7 in Spain Spain Down
Innovation award
Innovation award
Nominee: 1x

Details

===== 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 http://phpclasses.upperdesign.com Any suggestions are wellcome 3.- Contact information Carlos Falo Hervás slainte@jet.es

  Files folder image Files (2)  
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)

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:1,907
This week:0
All time:2,065
This week:488Up