Re: img tags from external src slow down my page
Hi Jim, You should do 1 in any case :) Point 2 is not so hard. Just download the file with HttpClient or the like. While you're reading from the stream you have to count bytes. Put this in a IValidator and attach it to the imageUrl textbox. If you go for point 3 then note that not all types of images can be converted by the java imaging library. In particular CYMK jpgs and tiff files are troublesome. Regards, Erik. Jim Pinkham wrote: I had a few ideas: 1. a note on the item entry page asking users to 'please don't do that'. :) 2. add an ImageURLValidator to check the image size somehow... hmmm... 3. find some utility to help read the image, properly size it, and store a local copy with my own id (filesystem should work fine) and let my model's imageURL property point to it. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: img tags from external src slow down my page
Yeah I think the apache proxy mod are one good bet for this ... So if you are using apache http, just add the proxy directive.. 2009/7/2 Igor Vaynberg : > its a matter of building a simple cache. all you need is a servlet > that can check if the image is on disk and if not download it, then > serve it from there > > mount the servlet on /external and rewrite your urls to be > /external?url= > > there are probably already things like this for apache, you just have > to rewrite the url so it passes through your site and doesnt go > directly to the external one. > > -igor > > On Thu, Jul 2, 2009 at 1:57 PM, Jim Pinkham wrote: >> Hi, >> >> I have an AjaxFallbackDefaultDataTable on the main page of my Wicket >> app with an image column like this: >> >> columns.add(new ImagePropertyColumn(new ResourceModel("imageURL"), >> "imageURL")); >> >> My item model has an imageURL string property backed by a database >> column, and it pretty much works OK. >> >> I don't need to store any images, bandwidth is low, and it's simple, >> but I have seen some users enter URLs to huge TIFF images that are not >> properly sized, and it makes my page display take forever. I'd like >> to try to fix or prevent this. >> >> I had a few ideas: >> >> 1. a note on the item entry page asking users to 'please don't do that'. :) >> 2. add an ImageURLValidator to check the image size somehow... hmmm... >> 3. find some utility to help read the image, properly size it, and >> store a local copy with my own id (filesystem should work fine) >> and let my model's imageURL property point to it. >> >> I'm trying to write this so it could scale up a bit without getting >> crazy - This app lists items for a charity fundraising auction event, >> so access is light for several weeks, then peaks at about 300 hits per >> day (I know, not much) for a few days. But on those peak days, I'd >> like it to be fast (despite the decrepit old server it's running on). >> >> I've got about 300 items to show on a single page (users prefer a >> simple scrollbar without pagination). Also, I should mention that I >> have a search form that 'decorates' the matching text as it filters >> rows, and I'd like to make it fast enough to take away the search >> button and just ajax refresh on keypresses. >> >> Thanks for any suggestions, links to examples ...etc. >> -- Jim. >> >> http://firstuucolumbus.org/auction >> >> - >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> For additional commands, e-mail: users-h...@wicket.apache.org >> >> > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: img tags from external src slow down my page
its a matter of building a simple cache. all you need is a servlet that can check if the image is on disk and if not download it, then serve it from there mount the servlet on /external and rewrite your urls to be /external?url= there are probably already things like this for apache, you just have to rewrite the url so it passes through your site and doesnt go directly to the external one. -igor On Thu, Jul 2, 2009 at 1:57 PM, Jim Pinkham wrote: > Hi, > > I have an AjaxFallbackDefaultDataTable on the main page of my Wicket > app with an image column like this: > > columns.add(new ImagePropertyColumn(new ResourceModel("imageURL"), > "imageURL")); > > My item model has an imageURL string property backed by a database > column, and it pretty much works OK. > > I don't need to store any images, bandwidth is low, and it's simple, > but I have seen some users enter URLs to huge TIFF images that are not > properly sized, and it makes my page display take forever. I'd like > to try to fix or prevent this. > > I had a few ideas: > > 1. a note on the item entry page asking users to 'please don't do that'. :) > 2. add an ImageURLValidator to check the image size somehow... hmmm... > 3. find some utility to help read the image, properly size it, and > store a local copy with my own id (filesystem should work fine) > and let my model's imageURL property point to it. > > I'm trying to write this so it could scale up a bit without getting > crazy - This app lists items for a charity fundraising auction event, > so access is light for several weeks, then peaks at about 300 hits per > day (I know, not much) for a few days. But on those peak days, I'd > like it to be fast (despite the decrepit old server it's running on). > > I've got about 300 items to show on a single page (users prefer a > simple scrollbar without pagination). Also, I should mention that I > have a search form that 'decorates' the matching text as it filters > rows, and I'd like to make it fast enough to take away the search > button and just ajax refresh on keypresses. > > Thanks for any suggestions, links to examples ...etc. > -- Jim. > > http://firstuucolumbus.org/auction > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
img tags from external src slow down my page
Hi, I have an AjaxFallbackDefaultDataTable on the main page of my Wicket app with an image column like this: columns.add(new ImagePropertyColumn(new ResourceModel("imageURL"), "imageURL")); My item model has an imageURL string property backed by a database column, and it pretty much works OK. I don't need to store any images, bandwidth is low, and it's simple, but I have seen some users enter URLs to huge TIFF images that are not properly sized, and it makes my page display take forever. I'd like to try to fix or prevent this. I had a few ideas: 1. a note on the item entry page asking users to 'please don't do that'. :) 2. add an ImageURLValidator to check the image size somehow... hmmm... 3. find some utility to help read the image, properly size it, and store a local copy with my own id (filesystem should work fine) and let my model's imageURL property point to it. I'm trying to write this so it could scale up a bit without getting crazy - This app lists items for a charity fundraising auction event, so access is light for several weeks, then peaks at about 300 hits per day (I know, not much) for a few days. But on those peak days, I'd like it to be fast (despite the decrepit old server it's running on). I've got about 300 items to show on a single page (users prefer a simple scrollbar without pagination). Also, I should mention that I have a search form that 'decorates' the matching text as it filters rows, and I'd like to make it fast enough to take away the search button and just ajax refresh on keypresses. Thanks for any suggestions, links to examples ...etc. -- Jim. http://firstuucolumbus.org/auction - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org