Usually I add a /etc directory for configuration files.
If you want to store the files in the filesystem it's better to have a
property like "image.directory" in a property file (ex. /etc/
myApp.property).
I don't have enough space in my project filesystem and I've placed the
images in another filesystem.


On Mar 13, 1:28 pm, "fatjack1...@googlemail.com"
<fatjack1...@googlemail.com> wrote:
> Ok, Thanks for all your replies.
>
> So which folder should I store the images in? Here is my current
> folder structure:
>
> -bin
> -src
> -temp
> -tomcat
> -WWW
>
> On Mar 13, 10:47 am, gregor <greg.power...@googlemail.com> wrote:
>
> > +1 to Ze's comment
>
> > My reply assumed you had a reason why you *must* store images in DB.
> > If you don't Ze is right that it is a very inefficient way to store
> > and serve images.
>
> > On Mar 13, 9:04 am, Zé Vicente <josevicentec...@gmail.com> wrote:
>
> > > Hi,
>
> > > I will give you my honestly opinion. It seems that you are new on the
> > > subject and I can say that I have a lot of experience on that.
>
> > > First of all, don't store images on the database :)
>
> > > It is true that we can do it, but depending of what you are going to
> > > do, the site of your database will be 90% images and 10% data.
>
> > > The images are always served by httpservers, even if you retrieve it
> > > from the database. So if you store the images in the file system of
> > > your httpserver, there is no need for network usage in case your
> > > database is hosted in a different server.
>
> > > So, use the database just to store the path of your images. Then in
> > > GWT, retrieve the object or list of objects that contains the path for
> > > your images. Again in GWT, Create an Image object and set the src
> > > property.
>
> > > That is all you need to do to display the image.
>
> > > What do you think?
>
> > > Regards,
> > > José Vicente
>
> > > On Mar 13, 2:52 am, Itamar Ravid <itamar.ira...@gmail.com> wrote:
>
> > > > Don't forget however to set the content type on the response to an 
> > > > image of
> > > > some type, otherwise the client's browser will try to download the 
> > > > picture
> > > > rather than display it.
>
> > > > On Fri, Mar 13, 2009 at 2:28 AM, gregor 
> > > > <greg.power...@googlemail.com>wrote:
>
> > > > > I think Itamar is right, Jack, you should use a standard HttpServlet
> > > > > for this, not GWT-RPC, because this sends the image over to the
> > > > > browser as byte steam, and I don't think RPC can do that.
>
> > > > > First, I take it these are not images used in your UI (like icons
> > > > > etc), 'cos those should go in an ImageBundle. I assume you know that &
> > > > > these images are downloaded as user selections etc.
>
> > > > > 1) Consult your MySQL docs/forum to find out how to obtain an
> > > > > InputStream for the image via JDBC. You want to pass an InputStream
> > > > > back to your image download HttpServlet. You don't want to read out
> > > > > the image bytes yet.
>
> > > > > 2) You write the HttpServlet something like this example (there are
> > > > > lots of others around):
>
> > > > >http://snippets.dzone.com/posts/show/4629
>
> > > > > Notice that the key is a looping read of the InputStream (which you
> > > > > got from MySQL) that writes straight into the HttpServlet's response
> > > > > OutputStream. Notice also it uses a buffer byte[] array. This is so
> > > > > that your web server does not get it's memory clogged up with big
> > > > > image byte arrays - the image bytes just get shunted from the DB
> > > > > straight out to the browser via this buffer. Therefore set this buffer
> > > > > small. Apache tend to use 2048 bytes. I think Oracle prefer 4096. That
> > > > > sort of size for the buffer. Take care to set the response content
> > > > > type so the browser knows what it's dealing with.
>
> > > > > 3) In your client you can set the Image widget's URL to your image
> > > > > download HttpServlet adding a parameter for the image id.
>
> > > > > regards
> > > > > gregor
>
> > > > > On Mar 12, 8:54 pm, "fatjack1...@googlemail.com"
> > > > > <fatjack1...@googlemail.com> wrote:
> > > > > > Hi,
>
> > > > > > I'm not too sure how to implement a HTTPServlet. Does anyone know 
> > > > > > how
> > > > > > to use images using RPC?
>
> > > > > > Im really stuck on this.
>
> > > > > > On Mar 12, 8:43 pm, Itamar Ravid <itamar.ira...@gmail.com> wrote:
>
> > > > > > > The best way, IMO, is to not use GWT-RPC, but rather implement an
> > > > > > > HttpServlet, that retrieves the data from the database and 
> > > > > > > returns it
> > > > > with
> > > > > > > the appropriate Content-Type in response to a GET http request. 
> > > > > > > Then,
> > > > > you
> > > > > > > simply place an image in your GWT code, with its source being the 
> > > > > > > path
> > > > > to
> > > > > > > the servlet (defined in your web.xml), passing along any 
> > > > > > > parameters
> > > > > required
> > > > > > > - such as the ID of the image in the database.
>
> > > > > > > On Thu, Mar 12, 2009 at 12:59 PM, fatjack1...@googlemail.com <
>
> > > > > > > fatjack1...@googlemail.com> wrote:
>
> > > > > > > > Hi,
>
> > > > > > > > I am new to loading images into GWT from MySQL and am abit lost 
> > > > > > > > on
> > > > > the
> > > > > > > > best way to do it.
>
> > > > > > > > I already have my image in the database. How do I retrieve it? 
> > > > > > > > I read
> > > > > > > > somewhere that it can just be stored as a String. Is this 
> > > > > > > > correct? So
> > > > > > > > my code on the server side would look like:
>
> > > > > > > > //Open database connection
> > > > > > > > dc.openConnection();
> > > > > > > > resultSet = dc.statement.executeQuery(SELECT CategoryImage FROM
> > > > > > > > itemcategory_table WHERE ItemType = 'Test');
>
> > > > > > > >   while(resultSet.next()) {
> > > > > > > >        String test = resultSet.getString(1);
> > > > > > > > }
>
> > > > > > > > dc.closeConnection();
>
> > > > > > > > Or have I got this completely wrong?
>
> > > > > > > > Next, I need to send this over to the client. What is the best 
> > > > > > > > way to
> > > > > > > > send an image over from the server to the client and how should 
> > > > > > > > it be
> > > > > > > > stored?
>
> > > > > > > > Any help on how to use images would be much appreciated!
>
> > > > > > > > Regards,
> > > > > > > > Jack
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to