david at kineticode
Nov 11, 2010, 8:17 AM
Post #7 of 8
On Nov 10, 2010, at 10:33 PM, Zdravko Balorda wrote:
> From documentation:
> $media = $container->get_related_media;
> If a media document is related to this container element, this method returns
> that media object.
> But correct me if I'am wrong, because I found some of my code saying:
> % my @img = $c->get_related_media if ($c);
> % my $r_img = shift @img;
You just need
my $r_img = $c ? $c->get_related_media : undef;
Never put "if bool" at the end of a `my ` statement. You'll end up with junk in your variable if $c is undef.
> Yes, but width is an element of media not the container related_media. I think. :)