[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"marketplace-site-banners":3,"@directus-labs\u002Fai-alt-text-writer-operation":9},[4],{"id":5,"icon":6,"content":7,"link":8,"include_paths":6,"exclude_paths":6},"5cf2f5f6-aecf-4395-8c23-69de326fdf02",null,"Directus V12 is here","https:\u002F\u002Fdirectus.com\u002Fresources\u002Fv12-built-for-the-whole-team",{"name":10,"description":11,"verified":12,"id":13,"readme":14,"type":15,"last_updated":16,"host_version":17,"downloads":18,"total_downloads":19,"sandbox":20,"license":21,"publisher":22,"versions":25,"formatted_name":96,"formatted_readme":97,"formatted_description":11,"featured_image":98,"images":99,"repository_url":80,"recent_downloads_7_days":19,"recent_downloads_30_days":19},"@directus-labs\u002Fai-alt-text-writer-operation","Use Clarifai to create captions for your image files.",false,"ea8dce82-795e-42fa-a12b-d0cb48d7d218","# AI Alt Text Writer Operation\n\nCreate captions for your images within Directus Files with this custom operation, using [Clarifai](https:\u002F\u002Fwww.clarifai.com).\n\n![The AI Alt Text Writer operation, showing available options](https:\u002F\u002Fraw.githubusercontent.com\u002Fdirectus-labs\u002Fextensions\u002Fmain\u002Fpackages\u002Fai-alt-text-writer\u002Fdocs\u002Foptions.png)\n\nThis operation requires two options to be set - first a personal access token from [Clarifai](https:\u002F\u002Fwww.clarifai.com) (you can find this in your personal settings under [Security](https:\u002F\u002Fclarifai.com\u002Fsettings\u002Fsecurity)), and a link to the image file. The operation will return a string containing a text that describes the image.\n\nYou can use the operation to then save the result to a file description or item, or run further automation on the output.\n\n## Output\n\nThis operation will output the text that was generated from the provided image:\n\n```json\n\"a photograph of a man standing in front of a large explosion of smoke\"\n```\n\n## Flow Setup\n\n### Automatically Write Alt Text For New Files\n\nCreate a Flow with an **Event Hook** action trigger and a scope of `files.upload`. Use the AI Alt Text Writer operation, setting the File URL to `https:\u002F\u002Fyour-directus-project-url\u002Fassets\u002F{{ $trigger.key }}`, being sure to provide your specific Directus Project URL.\n\nThis will work if your file is public, but if it isn't, you can append `?access_token=token` to the File URL, replacing the value with a valid user token that has access to the file.\n\nThis operation will trigger on every new file upload, regardless of location or filetype. You may wish to add a conditional step between the trigger and transcription operation. The following condition rule will check that the file is an image:\n\n```json\n{\n    \"$trigger\": {\n        \"payload\": {\n            \"type\": {\n                \"_contains\": \"image\"\n            }\n        }\n    }\n}\n```\n\n### Write Alt Text On-Demand\n\nCreate a Flow with a **Manual** trigger and select a collection with a file field, which should contain an image file. Set the Location to Item Page Only. To receive the file ID create a **Read Data** operation for the same collection, setting IDs to `{{ $trigger.body.keys[0] }}`.\n\nUse the AI Alt Text Writer operation, setting the File URL to `https:\u002F\u002Fyour-directus-project-url\u002Fassets\u002F{{ $last.file_field_name }}`, being sure to provide your specific Directus Project URL and file field name.\n","operation","2025-12-24T06:57:23.792Z","^10.10.0",[],0,true,"MIT",{"username":23,"verified":12,"id":24,"github_username":6,"github_name":6,"github_blog":6,"github_bio":6,"github_location":6,"github_company":6,"github_avatar_url":6},"GitHub Actions","d490bc00-b01e-443a-a62f-2c109aa009f9",[26,45,60,77],{"version":27,"package":13,"publisher":28,"type":15,"host_version":17,"publish_date":29,"verified":12,"id":30,"url_repository":6,"url_homepage":6,"url_bugs":6,"file_count":31,"unpacked_size":32,"sandbox":20,"sandbox_requested_scopes":33,"license":21,"bundled":40,"maintainers":41},"1.0.1","8486d50d-a6bc-45c6-8627-60f3c144732c","2024-03-18T20:25:32.841Z","27b52b93-5630-4897-9e0e-54e7d0eab79f",4,4990,{"request":34,"log":39},{"urls":35,"methods":37},[36],"https:\u002F\u002Fapi.clarifai.com\u002Fv2\u002F**",[38],"POST",{},[],[42,43,44],10595,10596,10597,{"version":46,"package":13,"publisher":28,"type":15,"host_version":17,"publish_date":47,"verified":12,"id":48,"url_repository":6,"url_homepage":6,"url_bugs":6,"file_count":31,"unpacked_size":49,"sandbox":20,"sandbox_requested_scopes":50,"license":21,"bundled":55,"maintainers":56},"1.0.0","2024-03-18T20:09:35.691Z","c28542e2-9e30-4175-b11e-2d4fbc7ffb1c",4924,{"request":51,"log":54},{"urls":52,"methods":53},[36],[38],{},[],[57,58,59],10592,10593,10594,{"version":61,"package":13,"publisher":62,"type":15,"host_version":17,"publish_date":63,"verified":12,"id":64,"url_repository":6,"url_homepage":6,"url_bugs":6,"file_count":31,"unpacked_size":65,"sandbox":20,"sandbox_requested_scopes":66,"license":21,"bundled":71,"maintainers":72},"1.0.2","74ce2e77-733a-4e9a-b96d-93bf6264f622","2024-12-18T11:05:18.193Z","f2b9b799-8659-4486-b528-643ce8666593",5119,{"request":67,"log":70},{"urls":68,"methods":69},[36],[38],{},[],[73,74,75,76],11715,11716,11717,11718,{"version":78,"package":13,"publisher":24,"type":15,"host_version":17,"publish_date":16,"verified":12,"id":79,"url_repository":80,"url_homepage":81,"url_bugs":82,"file_count":31,"unpacked_size":83,"sandbox":20,"sandbox_requested_scopes":84,"license":21,"bundled":89,"maintainers":90},"1.0.3","f7b2aee2-38e9-42c7-a2d4-ffff11863420","https:\u002F\u002Fgithub.com\u002Fdirectus-labs\u002Fextensions.git","https:\u002F\u002Fgithub.com\u002Fdirectus-labs\u002Fextensions#readme","https:\u002F\u002Fgithub.com\u002Fdirectus-labs\u002Fextensions\u002Fissues",5229,{"request":85,"log":88},{"urls":86,"methods":87},[36],[38],{},[],[91,92,93,94,95],13503,13504,13505,13506,13507,"AI Alt Text Writer Operation","\u003Ch1>AI Alt Text Writer Operation\u003C\u002Fh1>\n\u003Cp>Create captions for your images within Directus Files with this custom operation, using \u003Ca href=\"https:\u002F\u002Fwww.clarifai.com\">Clarifai\u003C\u002Fa>.\u003C\u002Fp>\n\u003Cp>\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fdirectus-labs\u002Fextensions\u002Fmain\u002Fpackages\u002Fai-alt-text-writer\u002Fdocs\u002Foptions.png\" alt=\"The AI Alt Text Writer operation, showing available options\">\u003C\u002Fp>\n\u003Cp>This operation requires two options to be set - first a personal access token from \u003Ca href=\"https:\u002F\u002Fwww.clarifai.com\">Clarifai\u003C\u002Fa> (you can find this in your personal settings under \u003Ca href=\"https:\u002F\u002Fclarifai.com\u002Fsettings\u002Fsecurity\">Security\u003C\u002Fa>), and a link to the image file. The operation will return a string containing a text that describes the image.\u003C\u002Fp>\n\u003Cp>You can use the operation to then save the result to a file description or item, or run further automation on the output.\u003C\u002Fp>\n\u003Ch2>Output\u003C\u002Fh2>\n\u003Cp>This operation will output the text that was generated from the provided image:\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-json\">\"a photograph of a man standing in front of a large explosion of smoke\"\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Ch2>Flow Setup\u003C\u002Fh2>\n\u003Ch3>Automatically Write Alt Text For New Files\u003C\u002Fh3>\n\u003Cp>Create a Flow with an \u003Cstrong>Event Hook\u003C\u002Fstrong> action trigger and a scope of \u003Ccode>files.upload\u003C\u002Fcode>. Use the AI Alt Text Writer operation, setting the File URL to \u003Ccode>https:\u002F\u002Fyour-directus-project-url\u002Fassets\u002F{{ $trigger.key }}\u003C\u002Fcode>, being sure to provide your specific Directus Project URL.\u003C\u002Fp>\n\u003Cp>This will work if your file is public, but if it isn't, you can append \u003Ccode>?access_token=token\u003C\u002Fcode> to the File URL, replacing the value with a valid user token that has access to the file.\u003C\u002Fp>\n\u003Cp>This operation will trigger on every new file upload, regardless of location or filetype. You may wish to add a conditional step between the trigger and transcription operation. The following condition rule will check that the file is an image:\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-json\">{\n    \"$trigger\": {\n        \"payload\": {\n            \"type\": {\n                \"_contains\": \"image\"\n            }\n        }\n    }\n}\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Ch3>Write Alt Text On-Demand\u003C\u002Fh3>\n\u003Cp>Create a Flow with a \u003Cstrong>Manual\u003C\u002Fstrong> trigger and select a collection with a file field, which should contain an image file. Set the Location to Item Page Only. To receive the file ID create a \u003Cstrong>Read Data\u003C\u002Fstrong> operation for the same collection, setting IDs to \u003Ccode>{{ $trigger.body.keys[0] }}\u003C\u002Fcode>.\u003C\u002Fp>\n\u003Cp>Use the AI Alt Text Writer operation, setting the File URL to \u003Ccode>https:\u002F\u002Fyour-directus-project-url\u002Fassets\u002F{{ $last.file_field_name }}\u003C\u002Fcode>, being sure to provide your specific Directus Project URL and file field name.\u003C\u002Fp>\n","https:\u002F\u002Fraw.githubusercontent.com\u002Fdirectus-labs\u002Fextensions\u002Fmain\u002Fpackages\u002Fai-alt-text-writer\u002Fdocs\u002Foptions.png",[98]]