Results 1 to 4 of 4

Thread: Best way to fix image that is not there.

  1. #1
    mastermind michael_gersitz's Avatar
    Join Date
    Aug 2003
    Location
    Buffalo
    Posts
    749

    Best way to fix image that is not there.

    I am working on a script that copies thumbnails onto my site. The problem is, for some entrys in the database, the thumbnail will not copy onto my site for some reason leaving an ugly image with a red x in it.

    Is there a simple way to stop this? By switching out the dead url, with a "no image" thumbnail url?

    Thanks In Advance!

  2. #2
    mastermind michael_gersitz's Avatar
    Join Date
    Aug 2003
    Location
    Buffalo
    Posts
    749
    Oh, by the way, I am using PHP.

  3. #3
    Senior Member agua's Avatar
    Join Date
    Sep 2005
    Location
    Pottsville, NSW
    Posts
    531
    One site work on has something similar where a default image is used if no image is found - here's the code:
    Code:
    if (empty($image_out)) {
    $result = db_query("select image, image_path, image_type from $sql_tbl[thumbnail] where id='$id'");
    	if (db_num_rows($result))
    		list($image, $image_path, $image_type) = db_fetch_row($result);
    	else {
    		header("Content-type: image/gif");
    		func_readfile($default_image, true);
    	exit;
    }
    I can't help you any further as I haven't got much of a clue with php
    I Do Website Design - but I am here to learn all about publishing

  4. #4
    Registered
    Join Date
    Aug 2006
    Location
    Sacramento, CA
    Posts
    208
    You could use the PHP function file_exists($filename) to check if the thumbnail file exists on your server and if not display the default image.
    ________
    YAMAHA VIRAGO 1100
    Last edited by rpanella; 03-17-2011 at 10:28 AM.

Similar Threads

  1. Photoshop - How do I resize an image in a layer?
    By Erin in forum Graphics & Multimedia
    Replies: 8
    Last Post: 10-20-2014, 04:29 PM
  2. Google Image Frame "Busting"
    By Todd W in forum General Chat
    Replies: 1
    Last Post: 11-15-2006, 11:27 PM
  3. image data entry kinda
    By Chris in forum The Marketplace
    Replies: 3
    Last Post: 06-05-2006, 06:14 AM
  4. Resizing an Image
    By izwar in forum Website Programming & Databases
    Replies: 11
    Last Post: 05-18-2006, 11:58 AM
  5. Image Borders for CSS
    By Chris in forum HTML, CSS, Layout, and Design
    Replies: 8
    Last Post: 08-11-2005, 09:41 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •