SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
Thread: Database Image Question
-
May 22, 2005, 05:40 #1
- Join Date
- May 2005
- Location
- Murfreesboro, TN
- Posts
- 26
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Database Image Question
I have a product database. I have allowed up to six images per product. The image portion which is what I am concerned with works like this:
pic1 = http://www.mywebsite.com/store/product_images/front.jpg
pic2 = http://www.mywebsite.com/store/product_images/back.jpg
etc.
I have one display module which works for all products based on the product you select:
To display product 1 in my display.php you code only this:
<tr>
<td align="center" valign="center" width="100%">
<p>[pic1]</p>
</td>
</tr>
The url is picked up from the database as described above.
What I don't know how to reference in order to be able to click for a larger image are the [pic1] tags etc. If it was a straight <a href with a specified url I would know what to do. I guess my question is what is the syntax of the code I would wrap around [pic1] in order to reference it correctly and display a larger image?
Instead of this:
<a href="taco.jpg"><img src="tacot.jpg" width=100 height=25 border=0 alt="click for larger taco"></a>
How do I introduce [pic1] into the equation?
I hope this is clear as mud! My first post here and I hope I am in the correct forum....
Thanks!
-
May 22, 2005, 16:16 #2
- Join Date
- Nov 2001
- Location
- Bath, UK
- Posts
- 2,498
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by tnchatmonk
Code:table: images id name alt full_size thumbnail 1 pic1 One /images/pic1.jpg /images_tn/pic1.jpg 2 pic2 Two /images/pic2.gif /images_tn/pic2.gif 3 pic3 Three /images/pic3.jpg /images_tn/pic3.jpg 4 pic4 Four /images/pic4.gif /images_tn/pic4.gif
Code:<p>Loriem.... [pic1]</p>
PHP Code:$picute_name = mysql_real_escape_string('pic1');
Code:SELECT title, full_size, thumbnail FROM images WHERE name = 'pic1';
PHP Code:<a href="<?php echo $full_size ?>">
<img src="<?php echo $thumbnail ?>"
alt="click for larger <?php echo $title ?>"></a>
HTML Code:<a href="/images/pic1.jpg"> <img src="/images_tn/pic1.jpg" alt="click for larger One"></a>
DouglasHello World
-
May 22, 2005, 16:38 #3
- Join Date
- May 2005
- Location
- Murfreesboro, TN
- Posts
- 26
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Doug,
Thanks so much for the response. I'll get on it and shake it out!
Appreciated very much!
Bookmarks