How Do You Show A Bundled Image With showNotification()?

3 views
Skip to first unread message

Brian Vargas

unread,
Oct 22, 2009, 9:49:44 AM10/22/09
to mozilla-l...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

Hi,

The IDL for platform.showNotification() [1] claims the third parameter
is the URI of an image to be loaded and displayed with the notification.
It works fine with a remote image pulled down over HTTP, but I'd like
it to display an image from the bundle. Is that possible?

Any help would be greatly appreciated. Thanks!

Brian

1:
http://mxr.mozilla.org/mozillasvn/source/projects/webrunner/components/public/nsIPlatformGlue.idl
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: What is this? http://pgp.ardvaark.net
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEAREDAAYFAkrgYvgACgkQ3YdPnMKx1ePbcwCgmYG3AFOrxH+YPIRwnQxk6xYu
xI8An2IHWpibbba0FB8ybsVydClZA5zs
=VslX
-----END PGP SIGNATURE-----

Jason Miller

unread,
Oct 22, 2009, 9:54:19 AM10/22/09
to mozilla-l...@googlegroups.com
It would be much easier to convert your image into a base64-encoded string and place that in your webapp.js file.

var notifyIconResource = "data:image/png;base64,
iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGP
C/xhBQAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9YGARc5KB0XV+IA
AAAddEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIFRoZSBHSU1Q72QlbgAAAF1J
REFUGNO9zL0NglAAxPEfdLTs4BZM4DIO4C7OwQg2JoQ9LE1exdlYvBBeZ7jq
ch9//q1uH4TLzw4d6+ErXMMcXuHWxId3KOETnnXXV6MJpcq2MLaI97CER3N0
vr4MkhoXe0rZigAAAABJRU5ErkJggg==
";

platform.showNotification(message, title, notifyIconResource);

- Jason

Jason Miller
519.872.0797 // developIT // Jason Miller Design
Developer of amoebaOS, Shutterborg, Delitweet & more

Brian Vargas

unread,
Oct 22, 2009, 10:00:06 AM10/22/09
to mozilla-l...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

Jason,

Wow, is that ugly. But it works, and I can't argue with success!

Thanks for the help!

Brian

Jason Miller wrote:
> It would be much easier to convert your image into a base64-encoded
> string and place that in your webapp.js file.
>
> var notifyIconResource = "data:image/png;base64,
>
> iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGP
>
> C/xhBQAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9YGARc5KB0XV+IA
>
> AAAddEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIFRoZSBHSU1Q72QlbgAAAF1J
>
> REFUGNO9zL0NglAAxPEfdLTs4BZM4DIO4C7OwQg2JoQ9LE1exdlYvBBeZ7jq
>
> ch9//q1uH4TLzw4d6+ErXMMcXuHWxId3KOETnnXXV6MJpcq2MLaI97CER3N0
>
> vr4MkhoXe0rZigAAAABJRU5ErkJggg==";
>
>
> platform.showNotification(message, title, notifyIconResource);
>
> - Jason
>
> Jason Miller
> 519.872.0797 // developIT <http://developit.ca/> // Jason Miller Design
> <http://jasonmillerdesign.com/>
> /Developer of amoebaOS <https://amoebaos.com/>, Shutterborg
> <http://shutterb.org/>, Delitweet <http://delitweet.com/> & more/
>
>
> On Thu Oct 22 2009 09:49:44 GMT-0400 (EST), Brian Vargas
> <mailto:br...@ardvaark.net> wrote:
>
>
> Hi,
>
> The IDL for platform.showNotification() [1] claims the third parameter
> is the URI of an image to be loaded and displayed with the notification.
> It works fine with a remote image pulled down over HTTP, but I'd like
> it to display an image from the bundle. Is that possible?
>
> Any help would be greatly appreciated. Thanks!
>
> Brian
>
> 1:
> http://mxr.mozilla.org/mozillasvn/source/projects/webrunner/components/public/nsIPlatformGlue.idl

>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: What is this? http://pgp.ardvaark.net
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEAREDAAYFAkrgZWYACgkQ3YdPnMKx1eNmPACg2fg9m/mB9kBftAEfXYEq3mjh
sm8An3O9E3ymrsHed8ZF4q46JcC4ENzd
=O2aq
-----END PGP SIGNATURE-----

Jason Miller

unread,
Oct 22, 2009, 10:01:58 AM10/22/09
to mozilla-l...@googlegroups.com
No problem, I had a similar idea earlier when trying to use multiple local JavaScript files, but I don't think Prism makes it easy to gain access to the bundle's cached location and the files therein.

Jason Miller

Matthew Gertner

unread,
Oct 22, 2009, 12:35:35 PM10/22/09
to mozilla-l...@googlegroups.com
You can also say resource://webapp/image.png where image.png is a file located in the webapp home directory (the place as webapp.ini).

Jason Miller

unread,
Oct 22, 2009, 1:10:12 PM10/22/09
to mozilla-l...@googlegroups.com
Ahh - I had hoped there was a simple URI for the bundle directory.
Thanks, that's going to be extremely useful.

- Jason

Jason Miller

On Thu Oct 22 2009 12:35:35 GMT-0400 (EST), Matthew Gertner wrote:
You can also say resource://webapp/image.png where image.png is a file located in the webapp home directory (the place as webapp.ini).

On Thu, Oct 22, 2009 at 3:01 PM, Jason Miller <ja...@developit.ca> wrote:
No problem, I had a similar idea earlier when trying to use multiple local JavaScript files, but I don't think Prism makes it easy to gain access to the bundle's cached location and the files therein.

Jason Miller Developer of amoebaOS, Shutterborg, Delitweet & more

On Thu Oct 22 2009 10:00:06 GMT-0400 (EST), Brian Vargas wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

Jason,

Wow, is that ugly. But it works, and I can't argue with success!

Thanks for the help!

Brian

Jason Miller wrote:
> It would be much easier to convert your image into a base64-encoded
> string and place that in your webapp.js file.
>
> var notifyIconResource = "data:image/png;base64,
>
> iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGP
>
> C/xhBQAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9YGARc5KB0XV+IA
>
> AAAddEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIFRoZSBHSU1Q72QlbgAAAF1J
>
> REFUGNO9zL0NglAAxPEfdLTs4BZM4DIO4C7OwQg2JoQ9LE1exdlYvBBeZ7jq
>
> ch9//q1uH4TLzw4d6+ErXMMcXuHWxId3KOETnnXXV6MJpcq2MLaI97CER3N0
>
> vr4MkhoXe0rZigAAAABJRU5ErkJggg==";
>
>
> platform.showNotification(message, title, notifyIconResource);
>
> - Jason
>
> Jason Miller
> 519.872.0797 // developIT <http://developit.ca/> // Jason Miller Design
> <http://jasonmillerdesign.com/>
> /Developer of amoebaOS <https://amoebaos.com/>, Shutterborg
> <http://shutterb.org/>, Delitweet <http://delitweet.com/> & more/
>
>
> On Thu Oct 22 2009 09:49:44 GMT-0400 (EST), Brian Vargas
> <br...@ardvaark.net> wrote:
>
>
> Hi,
>
> The IDL for platform.showNotification() [1] claims the third parameter
> is the URI of an image to be loaded and displayed with the notification.
> It works fine with a remote image pulled down over HTTP, but I'd like
> it to display an image from the bundle. Is that possible?
>
> Any help would be greatly appreciated. Thanks!
>
> Brian
>
> 1:
> http://mxr.mozilla.org/mozillasvn/source/projects/webrunner/components/public/nsIPlatformGlue.idl

>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: What is this? http://pgp.ardvaark.net
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

Brian Vargas

unread,
Oct 22, 2009, 2:02:48 PM10/22/09
to mozilla-l...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

Perfect! That's exactly what I was looking for - much cleaner.

Thanks!

Brian

Matthew Gertner wrote:
> You can also say resource://webapp/image.png where image.png is a file
> located in the webapp home directory (the place as webapp.ini).
>
> On Thu, Oct 22, 2009 at 3:01 PM, Jason Miller <ja...@developit.ca
> <mailto:ja...@developit.ca>> wrote:
>
> No problem, I had a similar idea earlier when trying to use multiple
> local JavaScript files, but I don't think Prism makes it easy to
> gain access to the bundle's cached location and the files therein.
>
> Jason Miller
>
> 519.872.0797 // developIT <http://developit.ca/> // Jason Miller
> Design <http://jasonmillerdesign.com/>
> /Developer of amoebaOS <https://amoebaos.com/>, Shutterborg
> <http://shutterb.org/>, Delitweet <http://delitweet.com/> & more/
>
>
> On Thu Oct 22 2009 10:00:06 GMT-0400 (EST), Brian Vargas
>> <br...@ardvaark.net <mailto:br...@ardvaark.net>> wrote:
>
>
>> Hi,
>
>> The IDL for platform.showNotification() [1] claims the third
> parameter
>> is the URI of an image to be loaded and displayed with the
> notification.
>> It works fine with a remote image pulled down over HTTP, but
> I'd like
>> it to display an image from the bundle. Is that possible?
>
>> Any help would be greatly appreciated. Thanks!
>
>> Brian
>
>> 1:
>
> http://mxr.mozilla.org/mozillasvn/source/projects/webrunner/components/public/nsIPlatformGlue.idl
>
>

>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: What is this? http://pgp.ardvaark.net
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEAREDAAYFAkrgnkgACgkQ3YdPnMKx1eMttQCePFlrgo5bcrlXvgnaLpZQPQBI
YWQAn0/VEEwPX179qt7HSZ3+v3zUjuXu
=QC4G
-----END PGP SIGNATURE-----
Reply all
Reply to author
Forward
0 new messages