I'm using below modules for image crop


Returning data in JSON API.

Using multiple paragraphs for images. I have 1 image as logo & 1 image as content.

For 1 image it's showing correct image width & height, X & Y co-ordinates (derivatives).

But for multiple image it copy same height, width, x, y co-ordinates to other images.

So it's not showing image wise derivatives for multiple images.

Once image is uploaded it saved to cloudinary.

"meta": {
"derivatives": {
"box": "http://res.cloudinary.com/XXX/image/upload/s--CJHoE3mM--/c_crop,h_400,w_400,x_29,y_46/test.jpg?itok=4GARJEFS",
"thumbnail": "http://res.cloudinary.com/XXX/image/upload/s--vlxu-1hL--/c_fit,h_100,w_100/test.jpg?itok=hed-1-Mh",
"wide": "http://res.cloudinary.com/XXX/image/upload/s--4-Vk3FhO--/c_crop,h_200,w_356,x_76,y_86/test.jpg?itok=GOzme5ht"

Does anyone faced this issue?


You can try the code

use Drupal\image\Entity\ImageStyle;
use Drupal\file\Entity\File;

$filed_images = $paragraphs->get('field_image')->getValue();
 $images =[];
 foreach ($filed_images as $image) {
            $images[] = ImageStyle::load('273x273')
  • It's loading image style for another image as well. But it's same value – Julia Aug 22 '18 at 11:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.