Java web application : managing picture/thumbnail galleries - java

I'm pretty new to Java web application and I just started a sample project in order to get some experience in this area.
Here's the matter on which I am currently working : let's assume that my web application will display a bunch of items with a grid containing a small picture (thumbnail) for each of them. What are the best or common practices to implement such an application, with consideration for performance issues (here, I'm mainly thinking about the payload size every time a user would load the list of items)?
Do we usually create a smaller size copy of the uploaded image files, or do we use some Javascript, CSS transformation, you name it, to reduce the images to display?
FYI, I'm using Spring MVC for my sample project.
Hope my question was clear enough. Thx in advance.

The best way is to create a separate thumbnail file for each picture when uploaded. When your client will display your gallery, he will only get reduced picture, and then save a lot of download and presentation time

Related

Linking Website form progress data to GIS

We are trying to develop a website for tracking the progress of pipeline and assets. I want to link progress data entered from forms developed in Java to GIS. We will be capturing all the lat and longs of pipeline stretch and lat and log of progress of work.
I need help in developing shapefile dynamically based on the progress and also to view that shape file in my webpage
The javascript API does have functionality for uploading shapefiles form your desktop into the browser, but you will need another tool to create those shapefiles based on the progress.
For uploading the shapefiles, see the example here: https://developers.arcgis.com/javascript/3/jssamples/portal_addshapefile.html
There may be more examples available at https://developers.arcgis.com/javascript/3/.
For creating the shapefiles dynamically, you could use ArcMap or ArcPro if you have those, or one of many python libraries to help write shapefiles. There may even be some Java libraries to help with this as well but I only work on the front end so I cannot help you there.
For something simple in context, the complexity of what kind of workflow to best suite your needs can range depending on these questions (and probably others I'm not thinking of):
Do you absolutely need to create a shapefile for this? Why can't you just push the form to a spatial database (e.g. PostGIS) and then return the XYs of the points or the string of XYs for line features, etc.?
Where is the source of the data & what is the format? Is it a PDF, text on an HTML page, a .csv file downloadable from a page, etc.? You may need to implement scraping (from a site) or download and update, or your data could be live streaming - these are all different workflows and you need to establish these boundaries before setting up your workflow.
If your end game are points, all you need is XYs in a table format to display in GIS software. If they are lines or polygons, it'd be a little different. Again - what output type are they and what are you trying to do with it (e.g. import into QGIS)?
Without these answers, it doesn't make sense for anyone to suggest something to you that could be totally impossible for you to execute. Please answer these and think through your workflow from beginning to end and/or visa versa.
Cheers,
Shawn

Speed optimization of Website with a lot of images

I am currently working on a website which involves a lot of images. The problem is all the images are uploaded by the user so I can't do anything to alter the images. The website runs quiet ok on local system but the speed drops too much on the server,it becomes too slow
I'd suggest you to use Timthumb. It creates a thumbnail by generating a URL on the fly and uses very minimal disk space.
If the users of your website are uploading the images, then I presume (there must be) an upload script. Inside of that script or directly after its execution you could compress or rescale the image to size needed on the website, shortening loading time. There is a PHP image processing library called ImageMagick here:
http://php.net/manual/en/book.imagick.php
There is the PHP GD image processing library here:
http://php.net/manual/en/book.image.php
I don't have much personal experience with them, but from my knowledge it looks like one will do the job. Off the top of my head, that's the best solution I can think of, and hopefully it works. There is not a lot you can change about your problem if you don't compress/scale the images, and these are probably your best options. Wish you the best.

A live image feed in Android?

What would be some ways to create an application that goes and fetches images (using URIs, that's the only way I've come across) so that the app's company can change the images without requiring alterations to the android code?
I've looked at URL redirection but it does not seem quite reliable.
(Each time the app starts, it goes and fetches the image for display)
Your app would pull images from
http://company.comm/images/1
http://company.comm/images/2
...
http://company.comm/images/n
and you would have a website/service that would allow to upload and set live images.
Using the Tumblr API achieved what I desired. It allows the fetching of the 6 most recent posts of a particular blog as JSON data. Recursively parsing the JSON received allows the program to dig in and use the URLs for a particular resolution.

Moving widgets on fly using GWT?

I have just started working with GWT. I was wondering how I can dynamically move widgets on fly (at web page on client browser) for example to move a row of table up and down, or upload a excel file and display its content right away....something like a dashboard I am talking about. Are there any comprehensive tutorial to refer.
Have a look at the gwt-dnd lib:
http://code.google.com/p/gwt-dnd/
GWT is made for doing the kind of things you are describing. To move widgets you can either set their position or dynamically modify their css. To move rows around in a table look at the api of whatever table class you are using. To upload an excel file do a google search for 'gwt upload' and there will be some instructions - but to display the file you will need to convert it (probably to xml). Converting the file on the server will depend on which server you are using - I also have seen a 3rd party widget that will do that for you.
If youre looking for transition effects or animations , than check out gwtquery. Its really similar to jquery and has pretty simple good examples to start with.

Securing images used in java applets

I am using a java applet in my web project and some images are shown in this java applet.
I want to limit users to pull images from the web page. What are possible techniques for a client user to save images used in a java applet which is used in a browser session, except "print screen"?
Any ideas are welcome.
Thanks.
..What are possible techniques for a client user to save images used in a java applet
I don't know about typical end-users, but I'd do these things to circumvent several security strategies:
1. Hide them in the archives
Look at the source of the page
Discover the location of the Jars
Download each one by direct fetch
Rename them to .zip and expand them (quick & dirty), then..
Sell your images for causing me that much inconvenience to get them in the form I want.
That last part was sarcasm (mostly), but just wanted to make the point that if you put something in a Jar, people can get it out.
2. Hide them on the server
Use a packet sniffer to discover the image locations by URL.
Pull each image directly (etc.)
3. Encrypt the images
You might use techniques to encrypt the images, then obfuscate the code that decrypts them, but that would also fail against a determined hacker.
4. Screen grab
As mentioned already. 'Last resort' - crude, but effective.
..Any ideas are welcome.
Don't pursue such strategies. You won't achieve any form of security worth having, it will just irritate the user.
If the image is a bitmap inside of a jframe it'll be hard to capture it without resorting to a screen grab. Just like using it in flash the image file itself won't actually exist anywhere on the client.

Categories