getThumbnail not working on an attribute object

Permalink 1 user found helpful
HI,
why, oh why, this is not working?

if($c->getAttribute('product_icon')) {
    $icon = Loader::Helper('image');
    $icon->getThumbnail($c->getAttribute('product_icon'), 128, 128);
    echo '<img class="product-icon" alt="test" src="'. $icon->src .'" width="'.$icon->width.'" height="'.$icon->height.'" />';
    }


While this is working as it should?

if($c->getAttribute('product_icon')) {
    $icon = Loader::Helper('image');
    $icon->outputThumbnail($c->getAttribute('product_icon'), 128, 128);
    }


>:(

carusog
 
carusog replied on at Permalink Reply
carusog
Hi, any idea?
Are API just broken?
Could be just after update to lates version?
pvernaglia replied on at Permalink Best Answer Reply
pvernaglia
I think like this:

if($c->getAttribute('product_icon')) {
    $ih = Loader::Helper('image');
    $icon = $ih->getThumbnail($c->getAttribute('product_icon'), 128, 128);
    echo '<img class="product-icon" alt="test" src="'. $icon->src .'" width="'.$icon->width.'" height="'.$icon->height.'" />';
    }
carusog replied on at Permalink Reply
carusog
What an idiot…
I didn't even test it but I am sure that's the issue.
Forgetting to assign the object to the variable it is a clear sign I need to go sleeping.

Thanks a lot for getting time to reply to such a stupid question.