This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
I have a prolem. For my application I dynamically download images for results form a database. I use a4j:mediaOutput to display them. The problem is that some images returned are not valid to display (can't even display them on a PC). Is there a way I can detect such thing and display sth like 'image unavailable' in it's place? I don't mean what happens if my image isn't downloaded or I can't connect to get it - this is easily done by checking if the byte array is null. The problem is that if I download an image but i.e. it is corrupted so can't be displayed. Does anyone have any advice?
Yes now I am using ImageReader.getFormatName() for this. I only wish the funcion would return the format in a mime type thing. So for example "image/jpeg" instead of "JPEG" - that way I could easily compare with what I download, without making some kind of a switch and predict the kind of images I might get.
Joined: Oct 13, 2009
If you are storing the MIME types in the server, as you already know the type is image.
So for custom basis may be, if you get something like this from the database for example
image/jpeg. You can take the substring after / and then compare the formats. I am not sure
how your MIME types are stored.
Joined: Sep 01, 2009
I though about that and I need to see the list of results I can get from getFormatName() and compere them with mime types. Maybe a simple upper case and 'equals' can do the trick. Thanks any way :>