|
View:
New views
1 Messages
—
Rating Filter:
Alert me
|
|
|
Image extension problemDear friends, We've got into a problem extending dmImage under FC5. We need to upload image, then read an IPTCM data through ImageGetIPTCMetaData and updated our new/extended fields with it. So here is what we did: 1. We've copied dmImage.cfc into our packages folder, along with _dmImage folder and its contents. 2. We edit dmImage.cfc and added new fields: <cfcomponent extends="farcry.core.packages.types.dmImage" displayname="Image" hint="Image Media" bUseInTree="1"> <cfproperty ftSeq="51" ftFieldset="Image Properties" name="Copyright" type="string" hint="Copyright notice" required="No" default="" ftType="string" ftlabel="Copyright notice" /> and then deploy it. 3. We've deleted all other properties and functiton from dmImage, except <cffunction name="display" access="public" output="true"> <cfargument name="objectid" required="yes" type="UUID"> <!--- getData for object edit ---> <cfset stObj = this.getData(arguments.objectid)> <cfinclude template="_dmImage/display.cfm"> </cffunction> 4. We start editing edit.cfm from _dmImage folder: We've added new properties to stProperties object: <cfif isDefined("FORM.submit")> <!--- perform the update ---> <cfset showform=0> <cfset error = false> <cfset oForm = createObject("component","#application.packagepath#.farcry.form")> <cfset stProperties = structNew()> <cfset stProperties.objectid = stObj.objectid> <cfset stProperties.title = form.title> <cfset stProperties.label = form.title> <cfset stProperties.alt = form.alt> <cfset stProperties.copyright = form.copyright> <cfset stProperties.author = form.author> <cfset stProperties.author_title = form.author_title> <cfset stProperties.bLibrary = form.bLibrary> <cfset stProperties.ownedby = form.ownedby> <cfset stProperties.keywords = 'test'> <cfset stProperties.bAutoGenerateThumbnail = form.bAutoGenerateThumbnail> <cfset stProperties.datetimelastupdated = Now()> <cfset stProperties.lastupdatedby = session.dmSec.authentication.userlogin> <cfset stProperties.imageFile = stObj.imageFile> <cfset stProperties.originalImagePath = stObj.originalImagePath> 5. Then in file upload added this: <cfif trim(form.defaultImage) NEQ ""> <!--- upload image ---> <cftry> <cfif len(imageAcceptList)> <cffile action="upload" filefield="defaultImage" destination="#application.config.image.folderpath_original#" accept="#imageAcceptList#" nameconflict="makeunique"> <cfelse> <cffile action="upload" filefield="defaultImage" destination="#application.config.image.folderpath_original#" nameconflict="makeunique"> </cfif> <!--- filesize check ---> <cfif cffile.FileSize GT application.config.image.imagesize> <cfthrow errorcode="01" message="Sorry the file you tried to upload exceeds the #application.config.image.imagesize/1024#kb limit.<br />"> </cfif> <cfcatch type="any"> <cfif cfcatch.errorCode EQ "01"> <!--- custom ---> <cfset errormessage = cfcatch.message> <cfelse> <cfset subS = listToArray(application.config.image.imagetype)> <cfset subS[2] = application.config.image.imagetype> <cfset errormessage = application.rb.formatRBString("errBadImageType",subS)> </cfif> <cfset error = true> </cfcatch> </cftry> <cfif error> <!--- <cfset subS = listToArray(application.config.image.imagetype)> <cfset subS[2] = application.config.image.imagetype> <cfset errormessage = application.rb.formatRBString("errBadImageType",subS)> ---> <cfelse> <!--- set poperties to insert into database ---> <cfset stProperties.imageFile = oForm.sanitiseFileName(cffile.ServerFile,cffile.ClientFileName,cffile.ServerDirectory)> <cfset stProperties.originalImagePath = cffile.ServerDirectory> <cfset XMPImage=ImageRead(cffile.ServerFile)/> <cfset XMPData= ImageGetIPTCMetaData(#XMPImage#)/> <cfdump var="#XMPData#"/> <cfset keywords= #XMPData.keywords#/> <cfset stProperties.keywords = #keywords#/> It doesnt not allow us to add this information into the database. What we are doing wrong? Please help! Thank you in advance, Mika --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "farcry-dev" group. To post to this group, send email to farcry-dev@... To unsubscribe from this group, send email to farcry-dev-unsubscribe@... For more options, visit this group at http://groups.google.com/group/farcry-dev?hl=en -~----------~----~----~----~------~----~------~--~--- |
| Free Forum Powered by Nabble | Forum Help |