0

Starting from the code in a previous question, I am now trying to post a user picture in a rule that displays a relationship between two users (User Relationships module.)

It is the requestees's picture I am trying to display (the $requestee variable is allowed)

Here is the code I have so far:

$imgpath = file_load(($requestee->picture[und][0]['uid']))->uri;
$image = theme('image_style', array('path' => $imgpath, 'style_name' => 'thumbnail', 'attributes' => array('class' => array('RequesteesPicture'))));
$link = l($image, "user/$requestee->uid", array('html' => TRUE));
print $link;

I see the placeholder for the pic. The link to the requestee's picture is correct and the image style is also correct. But the pic does not show.

What do I need to do to make the pic show up?

Thanks. :)

0

Try something like this, just for grins. Make sure you're actually returning the URI, and maybe provide an alternative image if they don't have one for themselves. Also, your link might be messed up.

I'm not entirely sure how you're getting that URI for the profile image.

$imgpath = $requestee->picture[und][0]['uid']->uri; // Maybe? I would think the URI is in the picture array.
$vars = array(
  'style_name' => 'thumbnail',
  'path' => $imgpath,
  'attributes' => array(
    'class' => array('RequesteesPicture'),
  ),
);
$image = theme_image_style($vars);
$link = l($image, "user/" . $requestee->uid, array('html' => TRUE));
print $link;

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.