You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Dan Adams <da...@ifactory.com> on 2005/09/28 19:06:20 UTC

[kind of OT] handling uploaded images

Ok, I have a business object where one of the properties is the filename
of an image which can be uploaded by the user. I'm wondering how people
normally deal with uploads as far as where they are stored and how they
are accessed. Thanks.

-- 
Dan Adams
Software Engineer
Interactive Factory


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


RE: [kind of OT] handling uploaded images

Posted by Patrick Casey <pa...@adelphia.net>.
	You can just write your own image service and then cache it there if
it's a high volume operation. Here, for example, is a snippet of code out of
a chart component I wrote. It's plucking png's out of cache and feeding them
back out in response to requests.

	public void service(IEngineServiceView acrg0, IRequestCycle cycle,
			ResponseOutputStream response) throws
ServletException, IOException {
		Object[] parms = this.getParameters(cycle);
		// we might have this chart in cache
		String cacheKey = (String) parms[9];
		response.setContentType("image/png"); 
		byte[] png = (byte[])
CacheFactory.pluckFromCache(CacheFactory.CHART_CACHE, cacheKey);
		if (png == null) {
			CorinnaChart chart = new CorinnaChart();
			chart.fromParms(parms);
			JFreeChart rc = chart.genChart();

			ChartUtilities.writeChartAsPNG(response, rc,
chart.getWidth(),
					chart.getHeight());
		} else {
			response.write(png);
		}
	}

> -----Original Message-----
> From: Dan Adams [mailto:dan@ifactory.com]
> Sent: Wednesday, September 28, 2005 10:21 AM
> To: Tapestry users
> Subject: RE: [kind of OT] handling uploaded images
> 
> That may be reasonable in my situation. But how does that work with
> using them as assets? Plus with an image that gets used frequently that
> means that it can't be cached correct?
> 
> On Wed, 2005-09-28 at 10:07 -0700, Patrick Casey wrote:
> > 	I put them as binary blobs in an attachment data table in the DB.
> >
> > 	--- Pat
> >
> > > -----Original Message-----
> > > From: Dan Adams [mailto:dan@ifactory.com]
> > > Sent: Wednesday, September 28, 2005 10:06 AM
> > > To: Tapestry users
> > > Subject: [kind of OT] handling uploaded images
> > >
> > > Ok, I have a business object where one of the properties is the
> filename
> > > of an image which can be uploaded by the user. I'm wondering how
> people
> > > normally deal with uploads as far as where they are stored and how
> they
> > > are accessed. Thanks.
> > >
> > > --
> > > Dan Adams
> > > Software Engineer
> > > Interactive Factory
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> --
> Dan Adams
> Software Engineer
> Interactive Factory
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


RE: [kind of OT] handling uploaded images

Posted by Dan Adams <da...@ifactory.com>.
That may be reasonable in my situation. But how does that work with
using them as assets? Plus with an image that gets used frequently that
means that it can't be cached correct?

On Wed, 2005-09-28 at 10:07 -0700, Patrick Casey wrote:
> 	I put them as binary blobs in an attachment data table in the DB.
> 
> 	--- Pat
> 
> > -----Original Message-----
> > From: Dan Adams [mailto:dan@ifactory.com]
> > Sent: Wednesday, September 28, 2005 10:06 AM
> > To: Tapestry users
> > Subject: [kind of OT] handling uploaded images
> > 
> > Ok, I have a business object where one of the properties is the filename
> > of an image which can be uploaded by the user. I'm wondering how people
> > normally deal with uploads as far as where they are stored and how they
> > are accessed. Thanks.
> > 
> > --
> > Dan Adams
> > Software Engineer
> > Interactive Factory
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
-- 
Dan Adams
Software Engineer
Interactive Factory


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


RE: [kind of OT] handling uploaded images

Posted by Patrick Casey <pa...@adelphia.net>.
	I put them as binary blobs in an attachment data table in the DB.

	--- Pat

> -----Original Message-----
> From: Dan Adams [mailto:dan@ifactory.com]
> Sent: Wednesday, September 28, 2005 10:06 AM
> To: Tapestry users
> Subject: [kind of OT] handling uploaded images
> 
> Ok, I have a business object where one of the properties is the filename
> of an image which can be uploaded by the user. I'm wondering how people
> normally deal with uploads as far as where they are stored and how they
> are accessed. Thanks.
> 
> --
> Dan Adams
> Software Engineer
> Interactive Factory
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org