PDA

View Full Version : Image path question


gigiloumill
01-27-2010, 02:32 PM
Good morning and happy new year.

Guys, can someone please explain to me how to do something.

I'm trying to send an image path to a database and have it retrieved via a php pagination. My question is 1) how can I find the image path in DW?

Once I send the image folder to the server, how can I find the image path?

Thanks.

tux
01-27-2010, 06:19 PM
To find the image path you could select the image in design view and then go to code view and it will be highlighted.

Personally I hard code the path to the image and just retrieve the file name from the DB.

ie.

<img src="MySite/Images/<?php echo $images['filename']; ?>" alt="My Image" title="My Image" >

gigiloumill
01-27-2010, 07:21 PM
Thanks, now, how can I find the image path once the image has been uploaded to the webhost server?

tux
01-27-2010, 07:27 PM
If you have uploaded the page to the root of your site and your Image folder is in the root, then it would just be...

YourImageFolder/yourfilename.gif

gigiloumill
01-27-2010, 07:52 PM
so, I would simply insert into database field

images/test.gif?

tux
01-27-2010, 09:30 PM
You could do but as I said, I hard code the path and then just have the file name in the DB.

So your <img> tag would look like this...

<img src="images/with your DB field returned here">

Here is a snippet of php code from my website that querys my DB....

$query = "SELECT * FROM images WHERE imageID='$imageID' ";
$result = @mysql_query($query);
$images1 = @mysql_fetch_array($result);

and my <img> tag from the page....

<img src="Images/Gallery/<?php echo $images1['imageURL']; ?>" />

where 'imageURL' is the field in my DB containing my image file name.

You can see that the path to my image folder is Images/Gallery/ and the file name is called from the DB using...

<?php echo $images1['imageURL']; ?>

Once the php script is run and the page is sent to the browser the final <img> tag would look like this....

<img src="Images/Gallery/myimage.gif" />

Hope this helps you understand a bit more.

gigiloumill
01-30-2010, 03:09 PM
Thank you for the info...