I need to server my images using their name ie: 0001.jpg, 0002.png

I have 100’s of pages and data built into a system of 150,000 images and I do not wish to rewrite 100’s of pages to accomodate your naming system.

How do I call my images by the name I uploaded them with? ie: 1000.jpg, 2020.png etc

I would assume a worker would do the trick but after 3 hours of searching here and Google I am ready to try a different service.

I do NOT care what the static portion of the url is as long as I don’t have to rewrite my entire website to accomodate the images not being name the same any more at the end… ie: logo.jpg 2040.png

Can anyone help? I think this could be done with a worker but I’ve never built one and I am starting to think it is easier just to use a CDN that doesn’t change my image name.

Advice?

HI, did you look at custom ids?

so you can make something like that:

https://imagedelivery.net/<YOUR_ACCOUNT_HASH>/logo.jpg/public

and if that doesn’t suit you, you can use worker to redirect your image requests to custom id paths:
https://<YOUR_DOMAIN>/images/(?P<IMAGE_ID>.*) →
https://imagedelivery.net/<YOUR_ACCOUNT_HASH>/<IMAGE_ID>/

Sounds amazing!

I clicked on everything but no instructions came up and I already spent 3 hours searching for this data on the Cloudflare site… lol I guess I should just type “custom ids” into Google? Sorry I am so basic, I’ve been building websites since 2002 so I find modern data repo’s to be hard to use… I am used to manuals and instructions not blogs and blurbs. :wink:

Can you give me a link to step by step instructions or the manual on this please? In Vulcan if possible.

what do you mean no instructions came up?
I pasted a link above to the documentation.

You would need to add “id” to the request to specify a custom id an image will be accessed with:

curl --request POST \
  https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/images/v1 \
  --header 'Authorization: Bearer <API_TOKEN>' \
  --form '[email protected]/<PATH_TO_YOUR_IMAGE>' \
  --form 'id=<PATH_TO_YOUR_IMAGE>'

This topic was automatically closed after 15 days. New replies are no longer allowed.