From: mh Date: Sat, 2 Mar 2002 11:37:26 +0000 (+0000) Subject: get rid of use of iamgeType.. unused now. X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=d11cec013819e0172c0e11b20ca802f4e104d4a9;p=mir.git get rid of use of iamgeType.. unused now. --- diff --git a/source/mir/misc/WebdbImage.java b/source/mir/misc/WebdbImage.java index 62ea7961..5a2936a5 100755 --- a/source/mir/misc/WebdbImage.java +++ b/source/mir/misc/WebdbImage.java @@ -17,17 +17,12 @@ import java.awt.image.renderable.ParameterBlock; public class WebdbImage { - // imageTypes - public final static int WEBDB_JPG=0; - public final static int WEBDB_GIF=1; - // default values for scaling private int maxIconSize=120; private int maxImageSize=640; private byte[] iconData; private byte[] imageData; - private int imageType; private int iconWidth; private int iconHeight; @@ -36,27 +31,24 @@ public class WebdbImage // constructor - public WebdbImage(byte[] image, int type) + public WebdbImage(byte[] image) throws IOException { - imageType=type; planarImage = JAI.create("stream",new ByteArraySeekableStream(image)); scaleImage(); } - public WebdbImage(byte[] image, int type, int iconMax) + public WebdbImage(byte[] image, int iconMax) throws IOException { - imageType=type; maxIconSize=iconMax; planarImage = JAI.create("stream",new ByteArraySeekableStream(image)); scaleImage(); } - public WebdbImage(byte[] image, int type, int iconMax, int imageMax) + public WebdbImage(byte[] image, int iconMax, int imageMax) throws IOException { - imageType=type; maxIconSize=iconMax; maxImageSize=imageMax; planarImage = JAI.create("stream",new ByteArraySeekableStream(image)); diff --git a/source/mircoders/producer/ProducerMedia.java b/source/mircoders/producer/ProducerMedia.java index 76c2f634..5d38acb8 100755 --- a/source/mircoders/producer/ProducerMedia.java +++ b/source/mircoders/producer/ProducerMedia.java @@ -12,6 +12,7 @@ import mir.module.*; import mir.entity.*; import mir.media.*; +import mircoders.media.*; import mircoders.entity.*; import mircoders.storage.*; import mir.storage.*; @@ -66,7 +67,7 @@ public class ProducerMedia extends Producer { Entity currentMediaType = DatabaseUploadedMedia.getInstance().getMediaType(currentMedia); String mediaHandlerName = currentMediaType.getValue("classname"); - Class mediaHandlerClass = Class.forName("mir.media.MediaHandler"+mediaHandlerName); + Class mediaHandlerClass = Class.forName("mircoders.media.MediaHandler"+mediaHandlerName); MirMedia currentMediaHandler = (MirMedia)mediaHandlerClass.newInstance(); String date = currentMedia.getValue("date"); diff --git a/source/mircoders/servlet/ServletModuleImages.java b/source/mircoders/servlet/ServletModuleImages.java index 9841466e..89df034e 100755 --- a/source/mircoders/servlet/ServletModuleImages.java +++ b/source/mircoders/servlet/ServletModuleImages.java @@ -90,16 +90,14 @@ public class ServletModuleImages extends mir.servlet.ServletModule EntityImages entImage = (EntityImages)mainModule.getById(id); if (imageData!=null && fileName!=null) { - String fileType = "-1"; - - //the where clause to find the media_type entry + //the where clause to find the media_type entry //from the content-type. //we use the media type entry to lookup the //media Handler/Storage classes String wc = " mime_type='"+contentType+"'"; EntityList mediaTypesList = DatabaseMediaType.getInstance().selectByWhereClause(wc); - String mediaTypeId = null; + String mediaTypeId = null; String mediaStorageName = null; String mediaHandlerName = null; @@ -135,15 +133,12 @@ public class ServletModuleImages extends mir.servlet.ServletModule if(mediaId!=null){ new ProducerMedia().handle(null, null, false, false, mediaId); } - } catch (Exception e) { - theLog.printError("setting uploaded_media failed: "+e.toString()); + } catch (Exception e) { + theLog.printError("setting uploaded_media failed: "+e.toString()); } //end try-catch - if (!fileType.equals("-1")) - entImage.setImage(imageData, fileType); - else - theLog.printError("Wrong file uploaded!"); + entImage.setImage(imageData); } _edit(id, req, res); } @@ -356,15 +351,8 @@ public class ServletModuleImages extends mir.servlet.ServletModule String fileName=mpReq.getFilename(); String contentType=mpReq.getContentType(); - String fileType = "-1"; - if (contentType.equals("image/jpeg")) fileType="0"; - if (contentType.equals("image/gif")) fileType="1"; - if (!fileType.equals("-1")) { - EntityImages entImage = (EntityImages)mainModule.getById(idParam); - entImage.setImage(imageData, fileType); - } - else - theLog.printError("Wrong file uploaded!"); + EntityImages entImage = (EntityImages)mainModule.getById(idParam); + entImage.setImage(imageData); } catch (IOException e) { throw new ServletModuleException("upload -- ioexception " + e.toString());} catch (ModuleException e) { throw new ServletModuleException("upload -- moduleexception " + e.toString());}