Hi I am using Image Widget Crop so that users can crop images according to predefined image styles. All would have worked fine without any issues had I been using Drupal in the conventional 'monolithic' way. But I am not. Instead, I have a headless Drupal setup.
That means that I do not have a Drupal theme to render my content. The problem created because of that is that apparently (from what I've read online), the actual styled images created using Image Widget Crop/Crop API are actually created when they are called/loaded in a theme. Now the theme can be backend as well. Below is what I think this happens chronologically.
- Create and save a post with an image cropped using Image Widget Crop.
- Cropped/styled image does not get created in the file system.
- Fetch the data using JSON API/Custom API Module
- Returns with empty image field because cropped/styled image is not yet created.
- Click on Edit post
- Cropped/styled image created. Because the preview of the cropped image is called by the edit form/backend theme.
- Fetch the data using JSON API/Custom API Module.
- All works fine.
What I want to do is execute some kind of hook which creates the styled/cropped image when a post is saved(step 1). That way when I fetch the data using JSON API, it is readily available.