Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Oct 2008
    Posts
    28
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Image Tag Question

    Hi
    This script is used to display image properties and image picture, I want to hide the empty image box that shows on the page before the form is submitted, any suggestions?? Thanks for any help. Joe

    Page url: http://www.portal80.org/Search/A_Image.php




    <body bgcolor='#ffffff'>
    PHP Code:
    echo "<center><form name='src' action='' method='post'>
    <font color='black'><b>URL:</b></font> 

    <input type='text' size='55' name='url' value='' />

    <input type='submit' name='submit' value='Process It' style='background-color:#000; color: #ffffff;'>
    <input type='reset' value='Clear' style='background-color:#000; color: #ffffff;'>
    </form></center>"

    PHP Code:
    error_reporting(0);
    $url $_REQUEST[url]; 
    PHP Code:
    $contents file("$url");
    for(
    $i=0$i<count($contents); $i++)
    $string .= $contents[$i];
    list(
    $width,$height) = getimagesize($url);
    echo 
    '<br /><b>Filename: ' $url '</b><hr>';
    $filename "$url";
    if ((
    $pos strrpos($filename".")) === FALSE);
    else {
    $extension substr($filename$pos 1);
    }
    echo 
    '<b>Width: '.$width.'<br>  ';
    echo 
    '<b>Height: '.$height.'<br>  ';
    echo 
    '<b>Extension: '.$extension.'<br> ';
    echo 
    '<b>Filesize: ';
    echo 
    strlen($string);
    echo 
    '<p><center><img src='.$url.'></center>'

  • #2
    New Coder
    Join Date
    Apr 2009
    Posts
    11
    Thanks
    3
    Thanked 0 Times in 0 Posts
    have you tried adding
    Code:
    style="display: none;"
    to the img tage when you are outputting it in php?

  • #3
    New Coder
    Join Date
    Jan 2009
    Posts
    58
    Thanks
    4
    Thanked 3 Times in 3 Posts
    from the top of my head...

    last line of php code

    PHP Code:
    echo '<p><center><img src='.$url.'></center>'
    change to

    PHP Code:
    if( $contents != "")
    {
    echo 
    '<p><center><img src='.$url.'></center>';  

    hope that works for you!

  • #4
    New Coder
    Join Date
    Oct 2008
    Posts
    28
    Thanks
    4
    Thanked 0 Times in 0 Posts
    I tried putting the display none tag in the image tag like this

    <img src='.$url.' style="display: none;">

    the empty box still shows but disappears when the form is submitted. I thought that would have worked. Thanks

  • #5
    New Coder
    Join Date
    Oct 2008
    Posts
    28
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Thanks CalumK,
    The "if" statement worked perfectly.
    Regards Joe

  • #6
    New Coder
    Join Date
    Jan 2009
    Posts
    58
    Thanks
    4
    Thanked 3 Times in 3 Posts
    no problemo!


  •  

    Posting Permissions

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