PDA

View Full Version : problem showing picture


swissbeets
07-01-2008, 10:09 PM
the image is not showing up


<?php print $sel_product['image_source'];?> /*printing it to make sure it is correct value i get = C:\wamp\www\website\images01-28-06_0014.jpg*/

<?php $ImgValue = $sel_product['image_source']; ?>


<img src="<?php print $ImgValue;?> ">

when i click on the broken image and click view selection source i get
<img src="C:%5Cwamp%5Cwww%5Cwebsite%5Cimages01-28-06_0014.jpg">any ideas?

lux
07-01-2008, 10:36 PM
store the relative path rather than the absolute path to the image in the database field

for example; if i was storing all my images in a folder called assets and my web pages were in the directory above it store the image path in the db as:

assets/my_pic.png

if the image is in the same directory as the web page only store the image name;

my_pic.png

in the database

swissbeets
07-01-2008, 11:24 PM
ok i am saving the only the picture name and then going to concatenate that in a new variable like so:

$picture = "C:\wamp\www\website\images\ " . $sel_product['image_source'];

then show the picture:

<img src="<?php print $picture;?> ">

but i am still coming up with the exact same problem as before the selected source is coming up as
<img src="C:%5Cwamp%5Cwww%5Cwebsite%5Cimages%5C%2001-06-06_1731.jpg">

lux
07-01-2008, 11:26 PM
so only concat the images/ part to the filename

swissbeets
07-01-2008, 11:32 PM
any time there is a "/" in my filename it is being replaced by %5C how do i undo this?

swissbeets
07-02-2008, 12:03 AM
nevermind, dumb mistake sorry