I am getting my images in the array.

I need to check the if image in the array is empty then it should be replaced with the thumbnail image.

Here is my code :

if (is_null($imageData->getData('demo_promo')) 

Can I resize the placeholder for specific class as I am using:


Please help me to replace the thumbnail image instead of the empty demo_promo in the array above. I tried many things but it doesn't work.

1 Answer 1


You can try below, Hope it will work.

$imageArr =  $imageData->getData('demo_promo');

// check variable is array or not

    echo "It is an Array";

//Check imageArr is empty

    echo "Given Array is empty";
    echo "Given Array is not empty <br>";

Using Count function


if(count($imageArr) > 0) {
    echo "Given Array is not empty <br>";
  • 1
    I know array is empty just want to replace with the magento default thumbnail
    – Rana Zain
    Sep 15, 2023 at 4:57
  • I have edit the question related to the Resize Place holder image.Please if you have any solution please share
    – Rana Zain
    Sep 15, 2023 at 13:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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