GUI Code
  Home arrow GUI Code arrow JPEG Directory thumbnail system
Codewalker Forums 
  Tutorials  
Database Articles  
Miscellaneous  
Navigation Usability  
PEAR Articles  
Programming Basics  
Server Administration  
XML Tutorials  
  Reviews  
Database Book Reviews  
Linux Book Reviews  
Miscellaneous Reviews  
PHP Book Reviews  
PHP Software Reviews  
Server Admin Reviews  
SQL Tool Reviews  
  Code Gallery  
Content Management Code  
Contest Code  
Counters Code  
Database Code  
Date Time Code  
Discussion Board Code  
Email Code  
File Manipulation Code  
GUI Code  
Link Farm Code  
Miscellaneous Code  
Search Code  
Site Navigation Code  
User Management Code  
Forums Sitemap 
Dedicated Servers  
Download TestComplete 
JMSL Numerical Library 
IBM® developerWorks
Weekly Newsletter 
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
GUI CODE

JPEG Directory thumbnail system
By: Codewalkers
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2003-03-24

    Table of Contents:

    Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Creates a set of thumbnails on a page (at a specified size) of JPEG images from a directory.
    Filters out any other files, so can be used in any directory not just a /images one.

    By : rock

    ---------------------------thumbs.php--------------------------

    <?php
    /*
    Will generate a pages width of
    thumbnailed GIF's and JPG's
    from a secified directory. Will work
    in a directory with other files in it
    with no problems.
    Thumbnail variables are set in gen.php

    Generated: 24/3/03
    Author: Rock
    */

    // Comments will be throughout

    // Set variables
    $default_dir = "./images"; // Relative to current location


    // Directory Scan
    if(!($dp = opendir($default_dir))) die("Cannot open $dir");
    // Place images into image tag
    while($file = readdir($dp)){
    if($file != '.' && $file != '..' && stristr($file,"jpg")) echo "<a href=\"$default_dir/$file\"><img src=\"./gen.php?$default_dir/$file\"></a>\r\n";
    }

    closedir($dp);


    ?>
    -----------------------end thumbs.php------------------------

    ------------------------------gen.php----------------------------

    <?php
    /*
    Will generate a pages width of
    thumbnailed GIF's and JPG's
    from a secified directory. Will work
    in a directory with other files in it
    with no problems. Part 2. The image
    creator.
    Aspect ratio is not supported.

    Generated: 24/3/03
    Author: Rock
    */

    // Comments will be throughout

    $t_width = 100; // Thumbnail width
    $t_height = 100; // Thumbnail height

    // get and display jpeg images
    if(stristr($QUERY_STRING,".jpg")){
    header("Content-type: image/jpeg");
    $srcimage = imagecreatefromjpeg($QUERY_STRING);
    $destimage = imagecreate($t_width,$t_height);
    $width = imageSX($srcimage);
    $height = imageSY($srcimage);
    imagecopyresized ($destimage,$srcimage,0,0,0,0,$t_width,$t_height,$width,$height);
    ImageJPEG($destimage);
    ImageDestroy($destimage);
    }
    /*
    //Support for GIF unavailable at this time

    elseif(stristr($QUERY_STRING,".gif")){
    header("Content-type: image/gif");
    $srcimage = imagecreatefromgif($QUERY_STRING);
    $destimage = imagecreate(100,100);
    $width = imageSX($srcimage);
    $height = imageSY($srcimage);
    imagecopyresized ($destimage,$srcimage,0,0,0,0,$t_width,$t_height,$width,$height);
    ImageGIF($destimage);
    ImageDestroy($destimage);
    }
    */

    // on a problem geneterate an image with ERROR in it
    else {
    $im = imagecreate(100,100);
    $blue = imagecolorallocate($im,0,0,200);
    $red = imagecolorallocate($im,255,0,0);
    imagestring($im,2,2,5,"ERROR",$red);
    imageGIF($im);
    imagedestroy($im);
    }

    ?>

    ---------------------------end gen.php-------------------------
    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

    More GUI Code Articles
    More By Codewalkers

     

    IBM® developerWorks developerWorks - FREE Tools!


    IBM DB2 Deep Compression ROI Tool

    The IBM DB2 Deep Compression ROI tool is designed for DBA’s and IT management personnel to perform a clinical analysis of the cost savings gained from the Storage Optimization feature of DB2 9 for Linux, UNIX and Windows. The feature, also known as Deep Compression, compresses data that lies within a database by up to 80% at times.
    FREE! Go There Now!


    NEW! A Layered approach to delivering security-rich Web applications

    As businesses grow increasingly dependent upon Web applications to provide services to customers, employees and partners, these complex applications become more difficult to secure. Although traditional security solutions protect Internet infrastructure layers, they do not guard against HTTP and HTML attacks. Many organizations that conduct security testing still deploy applications that allow attackers to manipulate their logic and wreak havoc on their business. To mitigate this risk, development and delivery teams must address Web application security throughout the lifecycle, addressing the many layers detailed in this paper.
    FREE! Go There Now!


    NEW! Addressing software-as-a-service challenges using Tivoli security and WebSphere solutions

    Building a software-as-a-service solution requires addressing a few key technical challenges. In this webcast, we'll focus on the role of IBM Tivoli Directory Server and WebSphere Portlet Factory in creating a Software as a Service solution. We will demonstrate how to use Tivoli Directory Server to prevent the user population of one tenant from accessing the virtual portal and portlet components of another tenant. We will also use the dynamic profile capability of WebSphere Portlet Factory to create multiple highly customized applications from one code base.
    FREE! Go There Now!


    NEW! Don't wait! Try the Rational Application Developer (RAD) v7.5 open beta code today

    Download the Rational Application Developer (RAD) v7.5 open beta code and start developing applications for the JEE5 standard which features EJB3.0, JPA, JSF 1.2, JSP 2.1 and Servlet 2.5 standards. When you use this beta you will see how you can increase developer productivity for already existing applications with improved support for refactoring, as well as adding new features to existing applications. In addition, the beta provides tooling for JD Edwards, Oracle, SAP, Siebel and PeopleSoft to improve the developer productivity with these enterprise systems.
    FREE! Go There Now!


    NEW! Download DB2 9.5 for Linux, Unix, and Windows

    Download a free trial version of IBM DB2 9.5 for Linux, UNIX, and Windows. DB2 9 is the result of a five-year development project that transformed traditional (static) database technology into an interactive data server that merges the high performance and ease of use of DB2 with the self-describing benefits of XML.
    FREE! Go There Now!


    NEW! Download DB2 Express-C 9.5

    Visit IBM developerWorks to download IBM DB2 Express-C 9.5, a no-charge version of DB2 Express 9 database server. DB2 Express-C offers the same core data server base features as other DB2 Express editions and provides a solid base to build and deploy applications developed using C/C++, Java, .NET, PHP, and other programming languages.
    FREE! Go There Now!


    NEW! Download IBM Rational Developer for System z

    Download a free trial version of IBM Rational Developer for System z, software that can help you deliver core development capabilities; the power of Java Platform, Enterprise Edition (Java EE); and rapid application development support to diverse enterprise application development teams. With comprehensive development tools to help create, deploy and maintain traditional enterprise and composite applications, Rational Developer for System z enables developers with different technical backgrounds to easily participate in important technology projects.
    FREE! Go There Now!


    NEW! Hello World: WebSphere Service Registry and Repository

    Manage, govern, and share services across your organization by using WebSphere Service Registry and Repository. Follow the hands-on exercises to learn how to navigate the Web interface to publish, find, reuse, and update services.
    FREE! Go There Now!


    NEW! Rational 'Talks to You' Teleconference Series

    This Fall, IBM Rational talks to you directly through a special teleconference series giving you access to the best minds in IBM Rational - product experts and market thought leaders who will answer your questions during these pre-scheduled telephone conference calls. Register today!
    FREE! Go There Now!


    NEW! Understanding Web application security challenges

    As businesses grow increasingly dependent upon Web applications, these complex entities grow more difficult to secure. Most companies equip their Web sites with firewalls, Secure Sockets Layer (SSL), and network and host security, but the majority of attacks are on applications themselves – and these technologies cannot prevent them. This paper explains what you can do to help protect your organization, and it discusses an approach for improving your organization’s Web application security.
    FREE! Go There Now!



    All FREE IBM® developerWorks Tools!

    GUI CODE ARTICLES

    - PHP Image Manipulation Class 1.0
    - Simple PHP-CAPTCHA,
    - dPhoto
    - nice looking dir index'r
    - Colorpicker
    - Exposure Gallery build 1226
    - Dynamic "AQUA" Buttons
    - AdminTool|1.0 for Exposure Gallery
    - Exposure Gallery v1.2
    - Crop Canvas
    - Display all available background colours
    - Exposure Gallery v1.0
    - JPEG Directory Thumbnail system (Apect ratio)
    - JPEG Directory thumbnail system
    - Change Background Color each day






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway