How to make the private image accessible with image style?

kr flag

I have a private image with this URL.

An image style is created for the above image on location

The problem is when I display the original image, it works fine. But when I display the image with style, the image is not displaying and in the console, I get 404.

When I try to access the original image through the browser, I can access the image. But when I try to access the image with style in the browser, I get the The requested page could not be found.

I can confirm the image is present in the specified location. But don't know what is the issue.

Can anyone tell what can be the issue?

kr flag

I found the solution.

Actually, the problem is that the image style URLs need an ITOK at the end of the URL.

So for that, I used the buildUrl function from the image style.

$image_style_url = $image_style->buildUrl($original_image_uri);

Now this gives a URL like this

And now with that URL, I can access the image with an image style.

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.