Robert
|
| Posted: 10/12/2002, 1:45 AM |
|
I used this code from the modified Employee Directory example for PHP4 and MySQL, all works really well, but I'd like to know if I can add some code here that will show an image file (ie: <img src="is_null.jpg"> ) instead of showing a blank image on the grid form in the case of a "null" value in my "pblop" field (blob field).
Thanks a billion in advance!
(1) HERE'S THE LABEL (Before Show) ON THE GRID FORM THAT SHOWs THE IMAGE:
$fldpblob = "<img src=\"show_simage.php?p_id=$fldp_id&quirk=" . time(). "\" width=125 height=75>";
***
(2) HERES THE SHOW_IMAGE.PHP "Page Properties/Events/Open":
$image_id = get_param("p_id");
if (!$image_id) die("no image");
$db->query("select pblob from specials where p_id=". $image_id);
if ($db->next_record()) {
Header ("Content-type: image/jpeg");
Header ("Pragma: no-cache");
echo $db->f("pblob");
exit();
}
|
|
|
 |
feha
|
| Posted: 10/12/2002, 8:21 AM |
|
try to replace this
if (!$image_id) die("no image");
as
if (!$image_id){$image_id="$default_image";}
//where $default_image should be $image_id or other source which will show your default image NoIMAGE
feha
www.vision.to
|
|
|
 |
Robert
|
| Posted: 10/15/2002, 8:07 PM |
|
Yes, that does work when I do as suggested with a number in place of "$default_image" :
//try to replace this (original code):
if (!$image_id) die("no image");
//as (previous suggestion):
if (!$image_id){$image_id="$default_image";}
//(Robert did With this to call on image_id #1 as the default blob image):
if (!$image_id){$image_id="1";}
**
On this same line of code - I am writing this as (like a rookie!) to show that I'd like to make the default image an actual line of "html" when the blob field is null. Is this possible, and if so, is it feasable? I ask this because if the image of the chosen default "image_id" ever gets changed, that would be unacceptable in my particular application (example below does not work of course).
How can this code be changed to do what I need?
if (!$image_id){"<img src=\"null.gif\">";}
Thanks for the time
|
|
|
 |
Robert
|
| Posted: 10/16/2002, 12:07 AM |
|
Never Mind! I got it..
if (!$image_id) die("<img src=\"null.gif\">");
My panic is done..
|
|
|
 |
feha
|
| Posted: 10/16/2002, 10:45 AM |
|
|
|
|
 |
feha
|
| Posted: 10/16/2002, 10:45 AM |
|
GREAT! 
regards
femi
www.vision.to
|
|
|
 |