Jump to content

Pulling images from DB


w00kie

Recommended Posts

I have a database with 10 thumbnail pictures, image1, image2, image3 and so fourth

when i add a picture, i add the - 'event_images/image1.jpg' for instance which is fine.

But, what i need help with is, if the cell for image1, is empty, it doesnt contain a path then to dispaly a Blank image. Such as 'event_images/spacer.jpg'


thanks for your help in advanced.

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]if ($image_1 == "") {

echo "<a href=event_images/blank.jpg><img name=eventimage src=event_images/blank.jpg width=40 height=40 border=2
></a> ";

} else {

echo "<a href=event_images/$image_1><img name=eventimage src=event_images/$image_1 width=40 height=40 border=2
></a> ";
}[/quote]

Thats what i was thinkinjg, would there be an easier way?
Link to comment
Share on other sites

If this what you are adding to the db:

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]when i add a picture, i add the - 'event_images/image1.jpg' for instance which is fine. [/quote]

And this is what you are using to retrieve:

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]src=event_images/$image_1 [/quote]

Then your src path is actually "event_images/event_images/image1.jpg". Which, unless you have your folders structred that way, would not be correct.

Also, I think this:

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]echo "echo "<a href=event_images/$image_1><img name=eventimage src=event_images/$image_1 width=40 height=40 border=2
></a> ";[/quote]

Should be:

[code]echo ('<a href=event_images/$image_1><img name=eventimage src=event_images/'.$image_1.' width=40 height=40 border=2
></a>');[/code]

If that doesnt help let us know...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.