{"id":547,"date":"2026-06-10T00:00:00","date_gmt":"2026-06-10T00:00:00","guid":{"rendered":"https:\/\/wordpress.securinsight.ca\/index.php\/2026\/06\/10\/cloudflare-images-manage-hosted-images-with-the-images-binding\/"},"modified":"2026-06-10T00:00:00","modified_gmt":"2026-06-10T00:00:00","slug":"cloudflare-images-manage-hosted-images-with-the-images-binding","status":"publish","type":"post","link":"https:\/\/wordpress.securinsight.ca\/index.php\/2026\/06\/10\/cloudflare-images-manage-hosted-images-with-the-images-binding\/","title":{"rendered":"Cloudflare Images &#8211; Manage hosted images with the Images binding"},"content":{"rendered":"<p>Use the Images binding to upload, list, retrieve, update, and delete images stored in Images directly from your Worker without managing API tokens or making HTTP requests.<\/p>\n<p>The <code>env.IMAGES.hosted<\/code> namespace supports the following storage and management operations:<\/p>\n<ul>\n<li><a href=\"https:\/\/developers.cloudflare.com\/images\/storage\/binding\/#uploadimage-options\"><code>.upload(image, options)<\/code><\/a> \u2014 Upload a new image to your account.<\/li>\n<li><a href=\"https:\/\/developers.cloudflare.com\/images\/storage\/binding\/#listoptions\"><code>.list(options)<\/code><\/a> \u2014 List images with pagination.<\/li>\n<li><a href=\"https:\/\/developers.cloudflare.com\/images\/storage\/binding\/#imageimageiddetails\"><code>.image(imageId).details()<\/code><\/a> \u2014 Get image metadata.<\/li>\n<li><a href=\"https:\/\/developers.cloudflare.com\/images\/storage\/binding\/#imageimageidbytes\"><code>.image(imageId).bytes()<\/code><\/a> \u2014 Stream the original image bytes.<\/li>\n<li><a href=\"https:\/\/developers.cloudflare.com\/images\/storage\/binding\/#imageimageidupdateoptions\"><code>.image(imageId).update(options)<\/code><\/a> \u2014 Update metadata or access controls.<\/li>\n<li><a href=\"https:\/\/developers.cloudflare.com\/images\/storage\/binding\/#imageimageiddelete\"><code>.image(imageId).delete()<\/code><\/a> \u2014 Delete an image.<\/li>\n<\/ul>\n<p>For example, you can upload an image from a request body and return its metadata:<\/p>\n<div>\n<figure>\n<pre data-language=\"ts\"><code class=\"language-ts\"><div><div><span>const<\/span><span> <\/span><span>image<\/span><span> <\/span><span>=<\/span><span> <\/span><span>await<\/span><span> <\/span><span>env<\/span><span>.<\/span><span>IMAGES<\/span><span>.<\/span><span>hosted<\/span><span>.<\/span><span>upload<\/span><span>(<\/span><span>request<\/span><span>.<\/span><span>body<\/span><span>,<\/span><span> <\/span><span>{<\/span><\/div><\/div><div><div><span><span>  <\/span><\/span><span>filename<\/span><span>:<\/span><span> <\/span><span>\"upload.jpg\"<\/span><span>,<\/span><\/div><\/div><div><div><span><span>  <\/span><\/span><span>metadata<\/span><span>:<\/span><span> <\/span><span>{<\/span><span> source<\/span><span>:<\/span><span> <\/span><span>\"worker\"<\/span><span> <\/span><span>},<\/span><\/div><\/div><div><div><span>}<\/span><span>)<\/span><span>;<\/span><\/div><\/div><div><div>\n<\/div><\/div><div><div><span>return<\/span><span> <\/span><span>Response<\/span><span>.<\/span><span>json<\/span><span>(<\/span><span>image<\/span><span>)<\/span><span>;<\/span><\/div><\/div><\/code><\/pre>\n<div>\n<div><\/div>\n<\/div>\n<\/figure>\n<\/div>\n<p>Or retrieve and serve the original bytes of a hosted image:<\/p>\n<div>\n<figure>\n<pre data-language=\"ts\"><code class=\"language-ts\"><div><div><span>const<\/span><span> <\/span><span>bytes<\/span><span> <\/span><span>=<\/span><span> <\/span><span>await<\/span><span> <\/span><span>env<\/span><span>.<\/span><span>IMAGES<\/span><span>.<\/span><span>hosted<\/span><span>.<\/span><span>image<\/span><span>(<\/span><span>\"IMAGE_ID\"<\/span><span>)<\/span><span>.<\/span><span>bytes<\/span><span>()<\/span><span>;<\/span><\/div><\/div><div><div><span>return<\/span><span> <\/span><span>new<\/span><span> <\/span><span>Response<\/span><span>(<\/span><span>bytes<\/span><span>)<\/span><span>;<\/span><\/div><\/div><\/code><\/pre>\n<div>\n<div><\/div>\n<\/div>\n<\/figure>\n<\/div>\n<p>For more information, refer to the <a href=\"https:\/\/developers.cloudflare.com\/images\/storage\/binding\/\">Images binding<\/a>.<\/p>","protected":false},"excerpt":{"rendered":"<p>Use the Images binding to upload, list, retrieve, update, and delete images stored in Images directly from your Worker without managing API tokens or making HTTP requests. The env.IMAGES.hosted namespace supports the following storage and management operations: .upload(image, options) \u2014 Upload a new image to your account. .list(options) \u2014 List images with pagination. .image(imageId).details() \u2014 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-547","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/wordpress.securinsight.ca\/index.php\/wp-json\/wp\/v2\/posts\/547","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.securinsight.ca\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wordpress.securinsight.ca\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.securinsight.ca\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.securinsight.ca\/index.php\/wp-json\/wp\/v2\/comments?post=547"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.securinsight.ca\/index.php\/wp-json\/wp\/v2\/posts\/547\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.securinsight.ca\/index.php\/wp-json\/wp\/v2\/media?parent=547"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wordpress.securinsight.ca\/index.php\/wp-json\/wp\/v2\/categories?post=547"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wordpress.securinsight.ca\/index.php\/wp-json\/wp\/v2\/tags?post=547"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}