sguener
Elite Observer

PictureResolution returns -1 for getSize()

Hi,

I'm currently working on a script, which is verifying media types set for "Media" elements. Especially the validation of pictures is tricky.

To verify a picture i use the following logic:

/* This is NOT the original code. The example code shall only illustrate the logic */

if (mediaType.equals(Media.PICTURE)) {

     extension = pictureResolution.getExtension();

     if ( extension != null && myPictureFileExtensionList.contains(extension)) {

          size = pictureResolution.getSize();

          ....... ...... .....

     }

}

The script is logging some elements as not valid due to size = -1 see example in beanshell console:

metadata_not_set.png

During investigations I've found out, that there is a valid picture set for the "original" (initial) resolution!

preview_black_but_shown.png

Export of the media file leads to the correct image, see below:

export_lightblue_68.png

Now my questions:

1. Is this a bug in FS 4.2.488, which is already fixed in 5.1.106 or higher?

2. If my validation logic is not recommended, are there any other capabilities via API?

Thanks in advance!

Original picture file added.

0 Kudos
3 Replies
Peter_Jodeleit
Crownpeak employee

Your screenshot is showing a complete black thumbnail - this is an indication that FirstSpirit 4.2.488 isn't capable of reading the image data correctly. Chances are high that this has improved with an up-to-date version of FirstSpirit. You could upload the picture here so that someone could check this.

Peter
0 Kudos

Hello Peter,

I've attached the original file. Due to the meta informations, the image was exported out of Photoshop CS2. It's curious that the compression is set to uncompressed. Maybe it's not a jpg!? meta.png

0 Kudos

Hello,

I imported the attached image into our demo project Mithras Energy (FS version: 4.2.499.59728).

The thumbnail looked fine, but I got the following exception:

FSVersion=4.2.499.59728#-1;JDK=1.7.0_51 32bit Oracle Corporation;OS=Windows 7 6.1 x86;Date=07.08.2014 11:47:39

de.espirit.common.io.IoError: javax.imageio.IIOException: Unsupported Image Type

     at de.espirit.common.imaging.ThumbnailProducer.loadImageSubSample(ThumbnailProducer.java:110)

     at de.espirit.common.imaging.ThumbnailProducer.load(ThumbnailProducer.java:40)

     at de.espirit.firstspirit.client.gui.media.picture.PicturePreviewGridView$PreviewLoader.refresh(PicturePreviewGridView.java:322)

     at de.espirit.firstspirit.client.gui.media.picture.PicturePreviewGridView$PreviewLoader.run(PicturePreviewGridView.java:300)

     at de.espirit.firstspirit.client.gui.util.GuiUtil$RunnableWrapper.run(GuiUtil.java:1508)

     at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

     at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

     at java.lang.Thread.run(Unknown Source)

Caused by: javax.imageio.IIOException: Unsupported Image Type

     at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(Unknown Source)

     at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(Unknown Source)

     at de.espirit.common.imaging.ThumbnailProducer.loadImageSubSample(ThumbnailProducer.java:102)

     ... 7 more

So I would ask you to contact our Helpdesk team. They can take a closer look.

Best regards

Michaela