Class Gallery
java.lang.Object
de.uplanet.lucy.server.auxiliaries.Gallery
Gallery.java Load an image, scale it down and save it as a JPEG file.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuildGallery(String p_strType, String p_strUploadTyp, String p_strGalleryDG, String p_strImgDG, String p_strFilename, String p_strSrcPath, String p_strGalleryName, int p_iGalLid) Method to build up a new Gallery, method calls are depending on filetype - CopyUploadImage(if img) - ExtractArchive(if zip) - DelFile(if neither zip nor img)copyUploadImage(String p_strImgDG, String p_strFilename, String p_strFileSrc, String p_strDirDst, int p_iGalLid) Method to copy an uploaded image in the right folder and insert the data in the ImageDGvoiddelDirectory(String p_strFolderName) Deletes the gallery specific directory and all images includedvoidMethod to delete a record from the datagroup where uploaded files are storedbooleanMethod to delete images, received from a vm, all checked images in the listview.extractArchive(String p_strImgDG, File p_fileArchive, File p_dirDest, int p_iGalLid) Method to extract a Zip-File and insert the data in the database at the same time The Zip-File is deleted afterwardsgetFileList(String p_strGalleryDG, String p_strImgDG, int p_iGalleryId) Method to return a map of images back to the vm, to realize the browsing through the imagesbooleanMethod to rotate an image, calls more methodsbooleanrotateImages(String p_strImgDG, int p_iGalleryId, int p_iAngle, String p_strGalleryName, String p_strImageName) Method to rotate all images, original,preview,thumg,detail, calls other method if keeporiginal = true, then rotate original, and scale it downbooleanMethod to rotate single image, original,preview,thumg,detail, calls other methodvoidscaleGallery(String p_strNewImages, String p_strFolderName, String p_strGalleryDG, String p_strImageDG, int p_iGalleryId) Method to scale all images in a galleryvoidMethod to update a record from the Gallery datagroup FILE_DATEIAUSWAHL Key has to be deleted after deleting the related record in the upload file datagroup
-
Constructor Details
-
Gallery
public Gallery()
-
-
Method Details
-
extractArchive
Method to extract a Zip-File and insert the data in the database at the same time The Zip-File is deleted afterwards- Parameters:
p_strImgDG- Tablename of image tablep_fileArchive- Zip Source Filep_dirDest- Destination where the files in the Zip-File are copied top_iGalLid- LID of the gallery in the gallery table.
-
copyUploadImage
public String copyUploadImage(String p_strImgDG, String p_strFilename, String p_strFileSrc, String p_strDirDst, int p_iGalLid) throws SQLException, IOException Method to copy an uploaded image in the right folder and insert the data in the ImageDG- Parameters:
p_strImgDG- Name of image table.p_strFilename- Name of the file.p_strFileSrc- Sourcepath of the file.p_strDirDst- Destination path of the file.p_iGalLid- LID of the gallery in the Gallerytable- Throws:
SQLExceptionIOException
-
buildGallery
public String buildGallery(String p_strType, String p_strUploadTyp, String p_strGalleryDG, String p_strImgDG, String p_strFilename, String p_strSrcPath, String p_strGalleryName, int p_iGalLid) throws SQLException, IOException Method to build up a new Gallery, method calls are depending on filetype - CopyUploadImage(if img) - ExtractArchive(if zip) - DelFile(if neither zip nor img)- Parameters:
p_strType- defines what kind of upload: new or updatep_strUploadTyp- defines what kind of file is being uploaded: jpg or zipp_strGalleryDG- Datagroup for Galleriesp_strImgDG- Datagroup for Imagesp_strFilename- Name of the Filep_strSrcPath- Sourcepath of the Filep_strGalleryName- Name of the Galleryp_iGalLid- LID of the Gallery in the Gallerytable- Throws:
SQLExceptionIOException
-
delDirectory
Deletes the gallery specific directory and all images included- Parameters:
p_strFolderName- The name of the directory to delete
-
delFileDB
Method to delete a record from the datagroup where uploaded files are stored- Parameters:
p_iFileLid- Id of the file to delete.p_strFileDG- Name of the file to delete.- Throws:
SQLException
-
updFileDB
Method to update a record from the Gallery datagroup FILE_DATEIAUSWAHL Key has to be deleted after deleting the related record in the upload file datagroup- Parameters:
p_iGalLid- Id of the gallery to updatep_strGalleryDG- Name of the gallery to update- Throws:
SQLException
-
scaleGallery
public void scaleGallery(String p_strNewImages, String p_strFolderName, String p_strGalleryDG, String p_strImageDG, int p_iGalleryId) throws Exception Method to scale all images in a gallery- Parameters:
p_strNewImages- String including all id's of the images to scalep_strFolderName- Name of the folder of the galleryp_strGalleryDG- Datagroup of the galleriesp_strImageDG- Name of the image datagroupp_iGalleryId- Id of the gallery- Throws:
Exception
-
getFileList
public Iterator<Map.Entry<Integer,String>> getFileList(String p_strGalleryDG, String p_strImgDG, int p_iGalleryId) throws SQLException Method to return a map of images back to the vm, to realize the browsing through the images- Parameters:
p_strGalleryDG- Datagroup of the galleriesp_strImgDG- Datagroup of the imagesp_iGalleryId- Id of the gallery- Returns:
- A map of images.
- Throws:
SQLException
-
rotate
public boolean rotate(String p_strImgDG, String p_strGalleryName, int p_iImgId, String p_strDirection) throws SQLException, IOException Method to rotate an image, calls more methods- Parameters:
p_strImgDG- Datagroup of the imagesp_strGalleryName- Name of the galleryp_iImgId- Id of the image to rotatep_strDirection- Direction of the rotation: left,right, always 90degrees- Returns:
- True, if no errors during rotation, else false.
- Throws:
SQLExceptionIOException
-
rotateImages
public boolean rotateImages(String p_strImgDG, int p_iGalleryId, int p_iAngle, String p_strGalleryName, String p_strImageName) throws SQLException, IOException Method to rotate all images, original,preview,thumg,detail, calls other method if keeporiginal = true, then rotate original, and scale it down- Parameters:
p_strImgDG- Datagroup of the imagesp_iGalleryId- Id of the galleryp_iAngle- degrees to rotate: 90,-90p_strGalleryName- Name of the galleryp_strImageName- Name of the image- Returns:
- True, if no errors during rotation.
- Throws:
SQLExceptionIOException
-
rotateImg
Method to rotate single image, original,preview,thumg,detail, calls other method- Parameters:
p_iAngle- degrees to rotate: 90,-90p_strImagePath- Fullqualified path to the image to rotatep_fComp- Compression ratio- Returns:
- True, if no errors during rotation.
-
delImages
public boolean delImages(String p_strImgDG, String p_strGalleryName, int p_iGalId, String p_strDelImgs) throws SQLException Method to delete images, received from a vm, all checked images in the listview. Deletes the images from the image datagroup and calls method to delete images from filesystem- Parameters:
p_strImgDG- Name of the image datagroupp_strGalleryName- Name of the galleryp_iGalId- Id of the galleryp_strDelImgs- String containing all IDs of the images to delete- Returns:
- True, if deletion worked withour errors.
- Throws:
SQLException
-