Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to write dynamic images to web server?

 
Qunfeng Wang
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a module for creating images dynamically, which is not a servlet. I'm trying to store the images on web server and return their URLs back to client. My question is how can I get to know the path of WebContent from my module. I hold a reference to the HTTPRequest, does it help? Or should I treat it a same process as client uploading images to server?

Thanks.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65545
110
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Louis Wang wrote:I have a module for creating images dynamically, which is not a servlet. I'm trying to store the images on web server

Exactly how are they being stored?

My question is how can I get to know the path of WebContent from my module

What is "WebContent"? A folder? TellTheDetails please.

I hold a reference to the HTTPRequest, does it help?

After the request is over? I hope not! Never hold a reference to a container object.

Essentially you treat it like any other image. The <ing> tag references a URL that serves the image data. That URL is usually to a static file or a servlet that streams the image data.
 
Qunfeng Wang
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Bear.

I intend to save images as files to the WebContent folder. The WebContent folder is where the static html pages located. It's supposed to be accessed by client through URLs.

For now I do it as below:
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65545
110
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, so if the file is being created on disk, how is it any different from any other image file? Just use an tag with a URL that addresses the file.
 
How do they get the deer to cross at the signs? Or to read this tiny ad?
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!