var retStruct = StructNew(); var initSize_i = 1; var reSize_i = 1; var categoryDataArray = ArrayNew(1); retStruct.photoDirList = ""; // Store all photo directories in a single list retStruct.initialSizeDirList = ""; // Store initial size directories in a single list retStruct.initialSizeArray = ArrayNew(1); retStruct.resizeDimDirList = ""; // Store resize directories in a single list retStruct.resizeDimensionArray = ArrayNew(1); retStruct.photoDirPath = ""; retStruct.photoURLPath = ""; retStruct.title = ""; // Title retStruct.directory = ""; // Directory // Get the category data categoryDataArray = application.ptPhotoGallery.photoDAO.getCategories(categoryID=arguments.categoryID); //application.ptPhotoGallery.utils.doDump(categoryDataArray,"categoryDataArray", false); if ( ArrayLen(categoryDataArray) ) { // Set some data values into the return structure retStruct.title = categoryDataArray[1].Values.title; retStruct.directory = categoryDataArray[1].Values.directory; // Get the initial size requirements for the category retStruct.initialSizeArray = application.ptPhotoGallery.photoDAO.getPhotoSizeData(photoSizeID=categoryDataArray[1].Values.reqSizeIDList); //application.ptPhotoGallery.utils.doDump(retStruct.initialSizeArray,"retStruct.initialSizeArray", false); for (initSize_i = 1; initSize_i LTE arraylen(retStruct.initialSizeArray); initSize_i = initSize_i + 1) { retStruct.initialSizeDirList = ListAppend(retStruct.initialSizeDirList,retStruct.initialSizeArray[initSize_i].Values.directory); retStruct.photoDirList = ListAppend(retStruct.photoDirList,retStruct.initialSizeArray[initSize_i].Values.directory); } // Check that we have a value for the resize dimensions if ( ListLen(categoryDataArray[1].Values.resizeSizeIDList) ) { // Get the resize dimensions for the category retStruct.resizeDimensionArray = application.ptPhotoGallery.photoDAO.getPhotoSizeData(photoSizeID=categoryDataArray[1].Values.resizeSizeIDList); //application.ptPhotoGallery.utils.doDump(retStruct.resizeDimensionArray,"retStruct.resizeDimensionArray", false); for (reSize_i = 1; reSize_i LTE arraylen(retStruct.resizeDimensionArray); reSize_i = reSize_i + 1) { retStruct.resizeDimDirList = ListAppend(retStruct.resizeDimDirList,retStruct.resizeDimensionArray[reSize_i].Values.directory); retStruct.photoDirList = ListAppend(retStruct.photoDirList,retStruct.resizeDimensionArray[reSize_i].Values.directory); } } // Set the photo directory path and URL retStruct.photoDirPath = "#application.ptPhotoGallery.appConfig.upload_path##retStruct.directory#/"; retStruct.photoURLPath = "#application.ptPhotoGallery.appConfig.upload_url##retStruct.directory#/"; } var retDataStruct = StructNew(); var photos_i = 1; var initSize_j = 1; var reSize_j = 1; var objImageInfo = StructNew(); var filePath = ""; var filename = ""; var origDirPath = ""; var origURLPath = ""; var photoInitSizeMatch = false; var photoType = ""; var fileOp = StructNew(); var dirOp = StructNew(); var resizeDirPath = ""; var resizeTempFileName = ""; var appConfig = application.ptPhotoGallery.getAppConfig(); retDataStruct.error = false; retDataStruct.originalURLPath = origURLPath; retDataStruct.originalDirPath = origDirPath; retDataStruct.error = true; retDataStruct.errorMsg = ""; The uploaded photo does not meet any of the dimension requirements.

Possible photo upload dimensions are the following:
   #arguments.categoryData.initialSizeArray[initSize_l].Values.title# = #arguments.categoryData.initialSizeArray[initSize_l].Values.width# X #arguments.categoryData.initialSizeArray[initSize_l].Values.height#
retDataStruct.error = true; retDataStruct.errorMsg = cfcatch.message; //retDataStruct.errorMsg = cfcatch.cause.message;
// check if the file exists if ( FileExists(expandpath(arguments.inArgs.inFile)) ) return true; else return false; UPDATE ImageGallery SET VersionState = 1, [Action] = 2 WHERE pageid = #arguments.imgGalPageID# var retStatus = StructNew(); // Check that we have a value to update if ( arguments.dataStruct.pageid GT 0 ){ // Update the datapageid to do an update dataStruct.values.dataPageID = arguments.dataStruct.pageid; // Pass the struct to the DAO retStatus = application.ptPhotoGallery.photoDAO.photoCCAPI(arguments.dataStruct.values); } var retPath = ""; var currPath = replace(arguments.destFile,"\","/","all") & ListLast(replace(arguments.srcFile,"\","/","all"), "/"); var fileOp = StructNew(); var formFieldVals = StructNew(); var tempPhotoDir = ""; var catData = StructNew(); var resizePhoto = ""; var imgGalleryStatus = StructNew(); var pageIDResult = StructNew(); // Extract the fields from the simple form formFieldVals = application.ptPhotoGallery.forms.extractFromSimpleForm(arguments.formVals, "photoID"); // Get the CE record for the Photo UUID dataArray = application.ptPhotoGallery.photoDAO.getPhotoData(photoID=formFieldVals.photoID); // Process the photo pageIDResult = processPhoto(dataArray[1].pageid, dataArray[1].formid); var pageIDResult = StructNew(); var dataStruct = StructNew(); var configData = application.ptPhotoGallery.photoDAO.getDocPaths(); var tempPhotoDir = ""; var catData = StructNew(); var resizePhoto = ""; var imgGalleryStatus = StructNew(); imgGalleryStatus.UPLOADCOMPLETED = true; // Set to true to by-pass if field is not checked. imgGalleryStatus.UPLOADRESPONSE = ""; // Set to true to by-pass if field is not checked. // CE Data to get the values for the element record dataStruct = application.ptPhotoGallery.cedata.getElementInfoByPageID(arguments.datapageid, arguments.formid); // Make Call back to set the photo fields from the DAO photoData = application.ptPhotoGallery.photoDAO.getPhotoData(photoID=dataStruct.values.photoid); dataStruct = photoData[1]; // Check if the photo has a value and is in the "temp" directory if ( ( StructKeyExists(dataStruct.values, "photo") AND ( LEN(dataStruct.values.photo) ) ) AND ( ListFindNoCase(dataStruct.values.photo, "temp", "/" ) ) ) { // Get the uploads directory path tempPhotoDir = ExpandPath(dataStruct.values.photo); // Get the category data structure catData = loadCategoryData(dataStruct.values.category, configData.docPath, configData.docURL); // Process the image resizing resizePhoto = processPhotoResize(catData, tempPhotoDir); //application.ADF.utils.dodump(resizePhoto, "resizePhoto", false); // Check if we have an errors with the resize if ( NOT resizePhoto.error ) { // Check if we want to upload to the Image Gallery if ( StructKeyExists(dataStruct.values, "includeImageGallery") AND (dataStruct.values.includeImageGallery EQ 'yes') ){ imgGalleryStatus = application.ptPhotoGallery.photoDAO.imgGalleryUpload(resizePhoto.originalDirPath); // Get the pageid value out if ( ListFirst(imgGalleryStatus.uploadResponse,":") EQ 'Success' ) dataStruct.values.imgGalleryPageID = ListLast(imgGalleryStatus.uploadResponse,":"); } // Update the path to store for the photo dataStruct.values.photo = resizePhoto.originalURLPath; // TODO - Check if the URL contains the "temp" directory then we have an error! // Update the Photo record with new data pageIDResult = handlePhotoUpdate(dataStruct); // Add the image gallery upload status back into the return pageIDResult.imgGalleryStatus = imgGalleryStatus; pageIDResult.photoData = dataStruct.values; } else { // TODO - Log the error message pageIDResult.contentUpdated = false; pageIDResult.msg = resizePhoto.errorMsg; pageIDResult.photoData = dataStruct.values; } } else { pageIDResult.contentUpdated = true; pageIDResult.msg = "No photo processing needed."; // 2012-06-26 - Add the image gallery upload status back into the return pageIDResult.imgGalleryStatus = imgGalleryStatus; pageIDResult.photoData = dataStruct.values; } if ( (StructKeyExists(server.ADF.environment, request.site.id)) AND (StructKeyExists(server.ADF.environment[request.site.id], "ptPhotoGallery")) ) return true; else return false; var retData = StructNew(); var photoUpdateStatus = processPhoto(arguments.datapageid, arguments.formid); // Build the return structure retData.html = ""; retData.photoData = photoUpdateStatus.photoData;
Photo Update Completed!

Click here to close and refresh. Click here to close.

Although an error occurred with importing photo into the CommonSpot Image Gallery.
[#photoUpdateStatus.imgGalleryStatus.UPLOADRESPONSE#]

Close Dialog

Photo Upload Error!

Error Message: #photoUpdateStatus.msg#

Click here to close and refresh. Click here to close.
var photoURL = ""; var dataArray = application.ptPhotoGallery.photoDAO.getPhotoData(photoid = arguments.photoid); if ( ArrayLen(dataArray) ) { photoURL = dataArray[1].values.photo; // Check if the size is defined if ( LEN(arguments.size) ) { photoURL = application.ptPhotoGallery.renderService.getPhotoURL(photoURL, arguments.size); } } // Get the cedata record var photoData = application.ptPhotoGallery.photoDAO.getPhotoData(photoid = arguments.photoUID); var deleteArgs = StructNew(); var delStatus = false; deleteArgs.categoryID = photoData[1].values.category; deleteArgs.inFile = photoData[1].values.photo; if ( StructKeyExists(photoData[1].values, "imgGalleryPageID") ) deleteArgs.imgGalPageID = photoData[1].values.imgGalleryPageID; // Delete the custom element record delStatus = application.ptPhotoGallery.cedata.deleteCE(photoData[1].pageid); if ( delStatus ){ // Then delete the file from the server return application.ptPhotoGallery.photoService.deletePhoto(deleteArgs); } else return delStatus; var retData = structNew(); // Get the profile data by the UID var photoData = application.ptPhotoGallery.photoDAO.getPhotoData(photoID=arguments.photoID); // Pass the userID to the handleEdit function to create the pages if ( ArrayLen(photoData) ){ retData = handlePhotoEdit(datapageid=photoData[1].pageid,formid=photoData[1].formid,lbAction=arguments.lbAction); } return retData; // Get the photo data for the URL var photoData = application.ptPhotoGallery.photoDAO.getPhotoData(photoURL=arguments.origPhotoURL); // Validate the photo data if ( ArrayLen(photoData) ) return photoData[1].values.photoID; // Default return return "";