Image thumbnails from a directory do no display

Discussion in 'PHP' started by bomyy, Jun 18, 2010.

  1. #1
    My script below is supposed to display thumbnail image links of images in a directory. My problem is the images do not display but that "x" which is displayed when the image is not found. How ever the filename is displayed below that "x" as a link and when I click it it open that specific file... What could be wrong in my script?

    I am new on PHP and this is frustrating me as I need this thing going ASAP


    THE SCRIPT

    <table border="1" cellpadding="5" cellspacing="5" bordercolor="#CCCCCC">
    <?php

    // Render the images in their rows
    foreach( $directories as $directory => $images ){
    $directory = substr( $directory, strlen( getcwd() ) + 1 );
    echo (
    str_replace
    (
    array(
    '[[images_per_row]]',
    '[[directory_name]]',
    ),
    array(
    $images_per_row,
    ($directory)?$directory:'[[current]]'
    ),
    '<tr><td colspan="[[images_per_row]]"><b>[[directory_name]]</b></td></tr>'
    )
    );
    $rows = ceil(count($images)/$images_per_row);
    for( $y = 0; $y < $rows; $y++ ){
    echo( '<tr>' );
    for( $x = 0; $x < $images_per_row; $x++ ){
    $index = $x + ( $y * $images_per_row );
    if( $index < count( $images ) ){
    echo
    (
    str_replace
    (
    array(
    '[[path]]',
    '[[image_name]]',
    '[[width]]',
    '[[height]]'
    ),
    array(
    (($directory)?$directory.'/':''),
    $images[ $index ],
    $max_width,
    $max_height
    ),
    '<td width="1%"><a href="[[path]][[image_name]]"><img border="0" src="get_image.php?image_name=[[path]][[image_name]]&width=[[width]]&height=[[height]]"><br>[[image_name]]</a></td>'
    )
    );
    }
    }
    echo( '</tr>' );
    }
    }
    ?>
    </table>
     
    bomyy, Jun 18, 2010 IP
  2. saviola

    saviola Peon

    Messages:
    17
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Probably the problem is in get_image.php. you have to check there how you try to print thumb img and why the script set this [X] img...
    .. you have to check List of Supported Protocols/Wrappers and see whether do you have error in functions, used by you.
    Do you have this in get_image.php :
    Header("Content-type: image/jpeg");
     
    saviola, Jun 18, 2010 IP