angular-gravatar icon indicating copy to clipboard operation
angular-gravatar copied to clipboard

use image as background

Open abdulqadir-ml opened this issue 10 years ago • 2 comments

Hello. I'd like to use gravatar images as background. Is there any way to do this currently? I've replaced this line (line no 423):

element.attr('src', gravatarService.url(newVal, opts));

with this:

element.css({'background-image': gravatarService.url(newVal, opts)});

I had to move this library out from bower to libs folder for this simple task. But I'm sure I'm missing out something! Any help would be appreciated. Thanks in advance.

abdulqadir-ml avatar Sep 15 '15 07:09 abdulqadir-ml

Hi, yes, you'll have to specify the background image url using the url(...) keyword (http://www.w3schools.com/cssref/pr_background-image.asp)

So: element.css({'background-image': 'url(' + gravatarService.url(newVal, opts) + ')'});

Settings background images from Gravatar is a very reasonable use-case, I'm gonna see if I can add this as a built in feature.

wallin avatar Sep 15 '15 12:09 wallin

Thanks for the prompt response! I'll look forward for this feature!

abdulqadir-ml avatar Sep 15 '15 13:09 abdulqadir-ml