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;
// 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));
import mir.entity.*;
import mir.media.*;
+import mircoders.media.*;
import mircoders.entity.*;
import mircoders.storage.*;
import mir.storage.*;
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");
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;
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);
}
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());}