Reputation: 9177
I'm new to Windows 8 apps and I'm trying to figure out how to reference images in the local folder with the scaled percentages like "logo.scale-100.png", "logo.scale-140.png", etc.
I can get the picture with the file name "logo.png" to show if I include it like this:
<img src="ms-appdata:///local/logo.png" alt="" />
(as shown here: http://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.applicationdata.localfolder)
But, I need to have the percentages in the file names, so is there a way to include that in the image tag somehow?
Upvotes: 1
Views: 48
Reputation: 7024
The .scale-nnn bit in filenames is to help Windows do automatic resource lookup for in-package resources only (and also includes lookup for language, contrast, and other settings, as described on How to name resources using qualifiers).
For images coming from local app data, you need to do more work on your own if you want to be sensitive to such variations. For example, get the current scaling factor from Windows.Graphics.Display.DisplayInformation.ResolutionScale and do your lookup accordingly. Or, use a single image that's high enough resolution to accommodate all sizes (and let the system scale it down).
Windows' resource manager doesn't apply, in other words, to images you reference from app data. I think the idea is that because you have to generate such images in the fly, you can generate the scales you need for the current device, whereas in a package you can't predict what device the app will run on so you need to provide pre-scaled (and language and contrast) variations ahead of time.
Upvotes: 1