Image resizing made available to endpoint
First of all, great working plugin.
Ive tried some this to get this working but unfortunately my knowledge of php didn't help me in this.
Is it possible to get an endpoint in a custom size in the files response?
eg.
"smallSize" : "http://localhost/content/example400x300.jpg"
I was thinking to add it to JsonApiUtil.php and to the new StaticField(). But i keep getting errors or empty responses. Could to point me in the right direction?
Thanks!
Found a -not so classy- way to solve it temporarily to just use the resizing url.
$id = $page->id();
$url = $page->site()->url();
// set width
$image_w = 500;
$image_h = round(( $file->height() * $image_w ) / $file->width());
// and then add this endpoint
'image_small' => new StaticField($url . '/thumbs/' . $id . '/' . $name . '-' . $image_w . 'x' . $image_h . '.' . $file->extension() ),
Sorry for the delay... work... you known how it is ;)
You are right that this is currently not possible in a reasonable manner, but I do appreciate you providing a workaround.
This seems like a reasonable thing that would pop up when creating rich interactive JavaScript apps and therefore I'll mark this as a feature request. I will have to think about how exactly this should work from an API perspective, but I'll let you know when I have a suggestion.