Access to Cloudflare Images

I am setting up CF Images and it's been pretty rough so far. I got Direct Upload going and now I want to serve the image. It looks like serving the image via a worker and using the fetch subrequest is the most flexible way to go. However, it is beyond me how I can access the image given the image id from the worker? Am I supposed to pass it a complete variant URL instead? Is there a way to load the source image by it's ID and apply transformations to it instead?
3 Replies
Felix
FelixOP6mo ago
Now, stripping everything back. I deployed this worker
const imageRequest = new Request(
"https://imagedelivery.net/<my image id>/public",
{
headers: request.headers,
},
);
return fetch(imageRequest, {
cf: {
image: {
width: 100,
height: 100,
},
},
});
const imageRequest = new Request(
"https://imagedelivery.net/<my image id>/public",
{
headers: request.headers,
},
);
return fetch(imageRequest, {
cf: {
image: {
width: 100,
height: 100,
},
},
});
it keeps serving the thing with the original size...
Felix
FelixOP6mo ago
second guessing myself going all in on CF now. this has been so painful. i have no clue what is going on and near 0 visibility.
No description
Felix
FelixOP6mo ago
now messing around with setting up routes in the trigger section of my images worker so it loads on <mydomain>/images/ endpoint and I confirm the wroker is running by way of console logging but now i am getting a 404 saying the source image does not exist even though the URL is hard coded and i can access it when I enter it into the browser... well, so the 404 only happens whenever i add the { cf: { image: { width: 100 } } } part to the fetch call.
Want results from more Discord servers?
Add your server