Hi there
I'm building an image file uploader using the JS API. It goes a bit like this:
js_api.createFileAsset({ "parentID":newResourceId, "friendly_name":resourceTitle.toLowerCase().replace(' ', '_') + extension, "type_code":'image', "link_type":"SQ_LINK_TYPE_1", "link_value":"", "dataCallback":function(data){ var imgFile; for (assetID in data){ imgFile = assetID; } js_api.acquireLock({ "asset_id":imgFile, "dependants_only":0, "force_acquire":1, "dataCallback":function(data){ js_api.updateFileAssetContent({ "asset_id":imgFile, "content":imgData, //some base64-encoded data "dataCallback":createComplete }); } }); } });
It all works nicely, but I can't figure out how to get a trigger to run when my image has been created. I've set up a trigger to run on asset created and simple edit accessed which creates an image variety. The varieties create properly when I create images in the admin interface, but not when they're created via the JS API on the frontend.
Is there a different trigger action that I can use to fire when I'm finished with the updateFileAssetContent event?