Create Image's Thumbnail on-the-fly

Nov 4, 2008 | Tags: PHP, Image | del.icio.us del.icio.us | digg Digg

Use this class to display your images with scale. Its very useful to create your images' thumbnail in your image gallery or shopping cart applications. You use this class by put it directly in your <img> tag like this:

Listing 1: listing-1.html

  1. <!-- display product1.jpg in original size -->
  2. <img src="image.php?filename=product1.jpg">
  3.  
  4. <!-- display product2.jpg scaled by 0.4 -->
  5. <img src="image.php?filename=product2.jpg&scale=0.4">
  6.  
  7. <!-- try to display missing.jpg,
  8.      if it doesn't exist, display default image -->
  9. <img src="image.php?filename=missing.jpg">

Requirements:

  • PHP with GD support enabled.

Features:

  • Display image in any scale
  • Support JPEG, GIF and PNG images
  • Display default image if requested image doesn't exist.

Related Articles

The Downloads

Leave a comment

Name (required)
Email (will not be published) (required)
Website

Characters left = 1000

Tags

Recent Posts

  1. OpenCV Utility: Reading Image Pixels Value
  2. OpenCV Circular ROI
  3. OpenCV 2.0 Installation on Windows XP and Visual Studio 2008
  4. Runtime ROI Selection using Mouse
  5. Real Time Eye Tracking and Blink Detection
View Archives

About the Author

avatar Cool PHP programmer writing cool PHP scripts. Feel free to contact
Tel. +62 31 8662872
+62 856 338 6017
ICQ 489571630
Skype dede_bl4ckheart
Yahoo dede_bl4ckheart
Google nashruddin.amin

Recommended Sites:

Hacker's HTTP Client
HTML and CSS Tutorials
Stop Dreaming Start Action
Online Quran and Translation