2

http://www.scientiamobile.com/page/angularwit

Want to be able to do something like this:

<img-wit ng-src="{{trustSrc(profile.pic)}}" w="100"/>

The picture isn't rendering however, although the blank space is sized correctly. Is it possible to use angular directive version of img-wit with ng-src?

UPDATE:

Determined the easiest way to use img-wit is not to implement angularjs directive at all. Instead, just append appropriate img-wit link prefix inside controller.

claireablani
  • 7,804
  • 5
  • 16
  • 19
  • not in the current implementation of the directive. It [just looks for a `src` attribute immediately upon initialisation](https://github.com/WURFL/angular-wurfl-image-tailor/blob/master/src/angular-wurfl-image-tailor.js), which won't work with `ng-src` since the `src` attribute won't be immediately available. – user2943490 Dec 18 '14 at 02:12
  • Hi, Luca Passani, ScientiaMobile CTO here. I just noticed this post now (for some reason, I don't seem to have received a notification when this was posted to SO). We discussed this with the engineer. We will add support for ng-src. Please stay tuned. Thanks – Luca P. Jan 19 '15 at 13:21

1 Answers1

3

Support to ngSrc directive has been added in the 0.9.1 version: https://github.com/WURFL/angular-wurfl-image-tailor/releases/tag/0.9.1.

Syntax like the follow is now supported:

<img-wit ng-src="{{myUrl}}"></img-wit>

where {{myUrl}} is the url of the trusted image to load.

Please check https://github.com/WURFL/angular-wurfl-image-tailor#how-to-use-it for further details.

Disclaimer: I work for ScientiaMobile

lucor
  • 31
  • 4
  • Hi lucor, thanks! that's awesome! I will let you know once I've implemented it. – claireablani Jan 21 '15 at 05:23
  • Hi lucor, I'm hoping to use the wurfl image tailor service to display profile pictures on a social media site. However, I don't see a way to trigger cache refresh. If a user updates their profile photo, is there some way to request a cache refresh? – claireablani Jan 27 '15 at 07:50
  • Hi @claireablani, you can query string your image adding a random number or a version like `profile.png?v1` – lucor Jan 27 '15 at 10:51
  • Hi @lucor, I'm able to correctly use the imgWit directive for angular as described in the documentation. However, what I really need is to use imgWit with ng-src, rather than a hard-coded src string. Is that possible? – claireablani Jan 28 '15 at 01:06
  • @lucor: thanks for your response regarding cache. I decided to append the 'lastSaved' timestamp - similar to random string but a little less random. – claireablani Jan 28 '15 at 01:07
  • Yes, you can use ng-src starting from version 0.9.1, please see for details https://github.com/WURFL/angular-wurfl-image-tailor#how-to-use-it – lucor Jan 28 '15 at 10:32