0

Hi All,

When I am fetching a photo from the database, it is getting save into my tomcat server root directory. Now to use this photo i have to give path as C:\Program Files ...... I dont want to hard code this path in any of my web page. Is there is any way to either save the photo directly into my project folder or point the photo in the server.

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by gyannitin
0

You can use relative paths. An HTML element like <img src="/app/images/first.jpg" /> would render an image with the image URL being: http://yourhost/app/images/first.jpg . Assuming your project name is "app", this would require you to create an "images" directory in your project.

From a performance standpoint, you can rewrite the URLs to route all the images requests through a image caching service which would load images which aren't loaded yet and serve the already loaded images from memory rather than doing a disk read. And I'm pretty sure there are other cool ways of serving the images but the one which I mentioned previously is the simplest.

0

Hi,
When I am extracting the photo from the database, It is getting saved into my eclipse folder. I want them to get saved into a folder present in the project work area.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.