The image formtool uses the Uploadify plugin. It makes one request with XHR
to see if the file already exists (FarCry always returns no, or []), then a
second request through Flash to upload the image. To hook into the response
is a bit tricky, but something like this should do the job:

$j($fc.imageformtool(formprefix,propertyname)).bind("filechange",function(event,results){
    // your code here
});

To get the prefix you can either:

Hook into ft:object r_stPrefix="somevariable" (hint: not actually a struct)

OR

Override the image formtool edit function. Call super to get the default
edit HTML, then tack your custom JS onto the end. To get the prefix:
<cfset var prefix = left(arguments.fieldname,len(arguments.fieldname)-len(
arguments.stMetadata.name)) />

Blair


On Fri, Sep 20, 2013 at 2:55 PM, Phillip Rasmussen <
[email protected]> wrote:

> Hi,
> I'm wondering if someone could point me the right direction.
> This is what I'm trying to achieve:
> When the source image is uploaded I want the ajax call to return some
> information in json. Specifically in this case the IPTC data form the
> uploaded image. ie use ImageGetEXIFMetadata and ImageGetIPTCMetadata
> Then I can use jquery to populate the Title field among some custom ones.
>
> For the life of me I can't find where the source image is doing the
> cfreturn. I can see that the ajax call is returning [] but I can't find
> where to intercept it and send back some more useful information.
>
> <cfset stFile = getFileInfo(application.path.imageroot & stResult.value)
> />
> <cfimage action="info" source=
> "#application.path.imageroot##stResult.value#" structName="stImage" />
> <cfset stJSON["value"] = stResult.value />
> <cfset stJSON["filename"] = listlast(stResult.value,'/') />
> <cfset stJSON["fullpath"] = application.url.imageroot &
> getDirectoryFromPath(stResult.value) & urlencodedformat(getFileFromPath(
> stResult.value)) />
> <cfset stJSON["size"] = round(stFile.size/1024) />
> <cfset stJSON["width"] = stImage.width />
> <cfset stJSON["height"] = stImage.height />
>
> It seems that the above code in image.cfc should be used but doesn't seem
> to be. Is it fallback stuff? Should I be looking at the ajax function in
> image.cfc?
>
> My initial though was to do this with a beforeSave but the client really
> want to upload an image and edit the content inline rather than have to
> save it and then go back into it.
>
> Any suggestions would be appreciated.
>
> Regards
> Phil
>
> --
> You received this message cos you are subscribed to "farcry-dev" Google
> group.
> To post, email: [email protected]
> To unsubscribe, email: [email protected]
> For more options: http://groups.google.com/group/farcry-dev
> --------------------------------
> Follow us on Twitter: http://twitter.com/farcry
> ---
> You received this message because you are subscribed to the Google Groups
> "farcry-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message cos you are subscribed to "farcry-dev" Google group.
To post, email: [email protected]
To unsubscribe, email: [email protected]
For more options: http://groups.google.com/group/farcry-dev
--------------------------------
Follow us on Twitter: http://twitter.com/farcry
--- 
You received this message because you are subscribed to the Google Groups 
"farcry-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to