...

View Full Version : Image Tag Question



Papajo
05-04-2009, 08:32 PM
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'>


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>";




error_reporting(0);
$url = $_REQUEST[url];




$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>';

tommycahir
05-04-2009, 09:07 PM
have you tried adding
style="display: none;" to the img tage when you are outputting it in php?

CalumK
05-04-2009, 09:10 PM
from the top of my head...

last line of php code



echo '<p><center><img src='.$url.'></center>';


change to



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


hope that works for you!

Papajo
05-04-2009, 09:17 PM
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

Papajo
05-04-2009, 09:21 PM
Thanks CalumK,
The "if" statement worked perfectly.
Regards Joe

CalumK
05-04-2009, 09:56 PM
no problemo!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum