Wednesday, July 2, 2008

Simple trick to add PNGs as image resource

In the Open-dialog you get when you click New Image Resource, type *.png and press enter. Then you filter the "view" so that only PNG images show. You can use this trick to add other file-types as well.

I've used this trick in other applications for years, and thought it was common knowledge. A colleague of mine wasn't aware of this the other day, so I thought I should share it with you as well.

I don't know if this works on Mac/in Linux as I'm not familiar with their file system browsers.


Tim Tripcony said...

That works, but it still won't render in the Notes client. In fact, when I tried listing a PNG as the icon for an action button and previewed the form, it crashed Notes. It also locks the MIME type, so it may even cause problems rendering the resource in certain browsers. Probably best to just leave PNG's as generic file resources for now...

Tommy Valand said...

I'm more or less a pure Domino developer. From my point of view, I like to have images under image resources, where they (should) belong.

I've had no problems in using them on the web..

Greg G said...

I'm having the same problem as Tim. The image doesn't render.

Tommy Valand said...

This trick is only to make you able to store PNGs under image resources, not to put them under image resources so that you can use them in Notes..

In some (Domino) applications I have quite a bit of JS libraries (gzipped/uncompressed versions, etc). I don't want the file resources view to be cluttered with PNGs.

DominoGame said...

Speaking of pngs. I discovered that the domino web engine doesnt display any files called shadow. This is not a good thing for me as ExtJs have a file called shadow.png used all over their files.

Tommy Valand said...

@Dominogame: I don't think the Domino server is the problem. We haven't had any problems with particular file names being blocked on our server.

Check your web site configuration. You could also try turning off adblocking in your browser, to see if that helps.

Damien Serve said...

@Dominogame & Tommy Valand: I have the same problem on my Domino v7.0.2 server, the shadow.png file of the Ext framework is not served by the server http task. I tried to remove the ad bloker and inspected my server configuration with no succes.
I end up with renaming the file to shadow2.png, and modifying the core.css and ext-all.css files.
Hope this helps & sorry for my english

Anonymous said...

I was able to successfully use a .PNG in designer by doing the following:

1. Rename the png file at the OS level to filename.GIF
2. Add the file as a GIF image resource
3. Rename the image resource back to filename.png