get rid of use of iamgeType.. unused now.
authormh <mh>
Sat, 2 Mar 2002 11:37:26 +0000 (11:37 +0000)
committermh <mh>
Sat, 2 Mar 2002 11:37:26 +0000 (11:37 +0000)
source/mir/misc/WebdbImage.java
source/mircoders/producer/ProducerMedia.java
source/mircoders/servlet/ServletModuleImages.java

index 62ea796..5a2936a 100755 (executable)
@@ -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));
index 76c2f63..5d38acb 100755 (executable)
@@ -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");
index 9841466..89df034 100755 (executable)
@@ -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());}