Pebble.js app pulling in the wrong image resource - pebble-watch

I am trying to create a simple app in pebble.js using the cloud IDE
I have my resources loaded (47 of them) with a colour and a black and white image, with all the correct naming conventions. Here is a snippet from the appinfo.json
{
"file": "images/34_Unlockables.png",
"name": "IMAGES_34_UNLOCKABLES_PNG",
"type": "png"
},
{
"file": "images/45_Leaderboards.png",
"name": "IMAGES_45_LEADERBOARDS_PNG",
"type": "png"
}
When I reference the image by it's name, the app pulls in the wrong image totally. This is the same if I try the url as well
card.banner('images/45_Leaderboards.png');
card.banner('IMAGES_45_LEADERBOARDS_PNG');
both result in the wrong image (and it is always black and white).
Has anyone else hit a similar issue?

Related

Fine Uploader scaled image naming pattern

I am using the scaling image functionaliy of Fine Uploader and want to tweak it a little bit.
Let's say I have this configuration (from here)
scaling: {
sizes: [
{name: "small", maxSize: 100}
]
}
If I provide a file named image.png Fine Uploader is going to create a scaled version of my image according to the above configuration and give it the name image (small).png.
I am looking for a way to change this naming pattern - so that I get a custom name of the files which are sent to the server - for example small_image.png or similar. I want to achieve this at the Fine Uploader/browser/client side and not on my backend.
Any other (undocumented) option available besides forking the repo and introducing the change myself?

Why does Xcode ignore my .xcassets larger sizes for my app icon in an OS X app project?

I am tearing my hair out trying to set up a custom icon for my OS X app. I have created all of the image files needed:
mondrian_128x128.png
mondrian_128x128#2x.png
mondrian_16x16.png
mondrian_16x16#2x.png
mondrian_256x256.png
mondrian_256x256#2x.png
mondrian_32x32.png
mondrian_32x32#2x.png
mondrian_512x512.png
mondrian_512x512#2x.png
I have dragged each image into the appropriate well in my AppIcon xcassets area, and all ten images now appear there. (The ones larger than 32x32#2x all get displayed at the same size as the 32x32#2x one in Xcode, but perhaps that is as it should be; I am guessing Xcode does that to conserve screen real estate, since displaying a 1024x1024 image would take up the whole window.)
When I inspect these images in Xcode, by clicking on each well, it shows information in the inspector area that appears to be good – the correct name, size, scale, etc. Similarly, the .json file inside the .xcassets looks good:
{
"images" : [
{
"size" : "16x16",
"idiom" : "mac",
"filename" : "mondrian_16x16.png",
"scale" : "1x"
},
{
"size" : "16x16",
"idiom" : "mac",
"filename" : "mondrian_16x16#2x.png",
"scale" : "2x"
},
{
"size" : "32x32",
"idiom" : "mac",
"filename" : "mondrian_32x32.png",
"scale" : "1x"
},
{
"size" : "32x32",
"idiom" : "mac",
"filename" : "mondrian_32x32#2x.png",
"scale" : "2x"
},
{
"size" : "128x128",
"idiom" : "mac",
"filename" : "mondrian_128x128.png",
"scale" : "1x"
},
{
"size" : "128x128",
"idiom" : "mac",
"filename" : "mondrian_128x128#2x.png",
"scale" : "2x"
},
{
"size" : "256x256",
"idiom" : "mac",
"filename" : "mondrian_256x256.png",
"scale" : "1x"
},
{
"size" : "256x256",
"idiom" : "mac",
"filename" : "mondrian_256x256#2x.png",
"scale" : "2x"
},
{
"size" : "512x512",
"idiom" : "mac",
"filename" : "mondrian_512x512.png",
"scale" : "1x"
},
{
"size" : "512x512",
"idiom" : "mac",
"filename" : "mondrian_512x512#2x.png",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
When I build my app, however, things seem to be messed up. No build warnings or errors appear, but the built product does not have any but the smallest sizes. Specifically: AppIcon.icns, which is generated by Xcode, seems to have only the 16x16 and 16x16#2x images. I can see this by doing a QuickView of it in the Finder (as Apple recommends), or by opening it in Preview. Furthermore, the app itself, when I select it in the Finder, shows a blurry icon that is clearly scaled up from the small icon. And when I use NSApplicationIcon in an NSImageView in a panel, the icon displayed is tiny. The larger sizes have clearly not been copied over.
I've spent all morning reading about .xcassets on the web, watching a YouTube video on how to assemble them, and (of course) looking at Apple's rather unhelpful documentation. I can't for the life of me figure out what I'm doing wrong. Any ideas?
UPDATE:
I'm now experimenting with trying to get iconutil to make the ICNS, in the hopes of understanding why Xcode can't do it properly. I copied my AppIcon.appiconset to my Desktop and tried "iconutil -c icns AppIcon.appiconset". It said "AppIcon.appiconset:error: Invalid Iconset.". I changed the name to "AppIcon.iconset" in case that was an issue, and it changed its error to "AppIcon.iconset:error: Failed to generate ICNS." It occurred to me that maybe the images need to have the same name as the name of the .iconset, so I changed them all from starting with "mondrian" to starting with "AppIcon". Still getting "AppIcon.iconset:error: Failed to generate ICNS." Sure would be nice if iconutil printed out more helpful error messages.
I also just opened all of the image files in GraphicConverter, added an alpha channel, and saved them back out, thinking that perhaps an alpha channel was required (although I have seen no mention of that anywhere – but most apps do have alpha in their icon, so...). Again, no change: "AppIcon.iconset:error: Failed to generate ICNS.". Aargh.
UPDATE 2:
It now works. I'm not sure why. I added the modified images (alpha channel added, saved in GraphicConverter instead of from Photoshop Elements) that were in my experimental .iconset on my Desktop back into the AppIcon in the .xcassets of my Xcode project, cleaned and built, and it is now all good. iconutil still refuses to compile it to an ICNS, but Xcode can now do it. I have no idea why. Maybe something about the state of my project was corrupted, or maybe alpha was needed, or maybe GraphicConverter saves PNG files in a way that Xcode likes better than Photoshop Elements' format. Mysteries abound. Anyway, perhaps this record will be helpful to someone else in a similar situation.
I was experiencing the same problem. "Clean Build", "Clean Build Folder" (⎇⇧⌘K) and the other suggestions did not improve matters, but they did point me in the right direction.
I had followed this guide to create the iconset but it may be out of date and/or I made a mistake and fouled things up.
Before starting the following steps which seem to have resolved the issue I was able to view all the correct icons inside my app package.
View Package > Contents/Resources/*.icns
To reset everything I did the following:
Remove everything icon related from the project:
Use the Project Navigator to remove from the project the assetcatalog and iconset folders. I believe the icns folder was created by the command line icon utility and was not needed.
Manually remove the associated folders from the project folder.
Restart Xcode for good measure.
Add the icons again:
Since I still had all the correct icons in a iconset folder on the file system, I did the following to add the icons to the project:
In the Project Navigator right click the project folder and select "New File..."
Select OS X > Resource > Asset Catalog to create a new asset catalog folder in the project folder. Trying to point this to the existing iconset folder just seemed to complicate matters.
Click on the newly created assets folder in the Project Navigator and then right click on the new icon place holder in the center of the Xcode interface. Select "New Mac OS Icon" from the pop up menu. You should now see all the empty wells for the different icon sizes.
Right click again and "Import..." from your existing iconset folder(this step revealed that I had some extra .pngs Xcode didn't know what to do with). Drag and drop from one container to the other until all are filled and then remove the empty icon holder. Right clicking also reveals a useful "Get Asset Catalog" link at the bottom of the menu that is not easy to find via the normal help option (it's not under the main Editor menu at the top of the screen either).
Clean Build, Clean Folder and Build.
I found that if i re-saved the images using Preview.app, ensuring the right canvas size and ppi for each image, that I was able to get all 10 representations to show up in the resulting icns file.
My guess is that Photoshop or Photoshop elements is injecting extra junk into the files that the iconutil/xcode doesn't like. In fact post-save, every single file was substantially smaller (16x16 1x went from 374kb to 1kb).
In addition to the solutions above, saving the images using "sRgb" color profile solved the issue for me. it can be done by preview or photoshop or other preferred editor.

Is there a JWPlayer + Wowza, cross browser solution?

Having spend the last couple of days reading the manuals, watching videos and reading through the forum, I can honestly I have no idea what I'm doing.
My basic requirement is to display a video on a web page so that it works in all major browsers.
Easy in Chrome, not so easy in anything else it seems.
For example Firefox will say 'Error loading player, No playable sources available', or if I add more sources it simple prompts me to select a video player on my local machine and proceeds to download the file.
Here is where I'm at right now, of-course it does not work.
jwplayer("playerOMLNJWgiRjbu").setup({
"sources": [
{ "file": "rtmp://video.newnrg.com:1935/vod/mp4:sample.mp4"},
{ "file": "http://video.newnrg.com:1935/vod/mp4:sample.mp4/manifest.mpd" },
{ "file": "http://video.newnrg.com:1935/vod/mp4:sample.mp4/playlist.m3u8"},
{ "file": "http://video.newnrg.com:1935/vod/mp4:sample.mp4/manifest.f4m"},
{ "file": "rtsp://video.newnrg.com:1935/vod/sample.mp4" }
],
"rtmp": {
"bufferlength": 5
},
"primary": "flash",
"modes": [
{ "type": "flash", "src": "/app/src/jwplayer/jwplayer.flash.swf" }
]
});
HTTP tests:
rtmp://video.newnrg.com:1935/vod/mp4:sample.mp4 (200)
http://video.newnrg.com:1935/vod/mp4:sample.mp4/manifest.mpd (200)
http://video.newnrg.com:1935/vod/mp4.../playlist.m3u8 (200)
http://video.newnrg.com:1935/vod/mp4...4/manifest.f4m (200)
rtsp://video.newnrg.com:1935/vod/sample.mp4 (200)
In firefox when rtsp://video.newnrg.com:1935/vod/sample.mp4 is used it asks for a locally installed player to play the video file, yet pasting this URL into the browser address bar works.
I've looked at the wowza homepage to attempt to dissect how this library is being used.
Wowza config:
(on) MPEG-DASH
(on) Apple HLS
(on) Adobe RTMP
(on) Adobe HDS
(on) Microsoft Smooth Streaming
(on) RTSP/RTP
From my perspective I've certainly struggled to get to this point, and have the following questions.
Which is the preferred client side player, with a decent JavaScript API,
I like the JWPlayer api, so can it be used? and what is best practice in easy to follow steps 1, 2, 3.

ESPN image 300 pixels even though says 90 pixels

Just wanted to put this inaccuracy out there to fix.
When pulling from the Now API, the height and width given for some images does not correspond with the actual size of the image.
Example:
"images": [{
"height": 90,
"alt": "",
"width": 90,
"name": "Cowherd makes picks for Week 10 in the NFL",
"caption": "Cowherd makes picks for Week 10 in the NFL",
"credit": "",
"url": "http://a.espncdn.com/i/espnradio/stations/espn/shows/300/theherd.jpg"
},
The height is 90 and the width is 90 yet the image is actually 300px (as tipped off by the jpg url).
Seems to be happening with multiple images I've come across, can you please fix?
Thanks!
As of December 7 ESPN has closed their API to the public. Sorry to user2727221 who was looking for a response too. So no update has been made or will be made to API to fix.

Retrieve original/not modified image from home or feed

I retrieve photos from home with this graph API request https://graph.facebook.com/me?fields=home.filter(photos).
Then via the object ID I retrieve the images array that gives me different sizes like this :
"images": [
{
"height": 780,
"width": 1240,
"source": "https://fbcdn-sphotos-g-a.akamaihd.net/hphotos-ak-prn2/281028_10151592859979158_562775226_o.jpg"
},
{
"height": 81,
"width": 130,
"source": "https://fbcdn-photos-g-a.akamaihd.net/hphotos-ak-prn2/s75x225/969715_10151592859979158_562775226_s.jpg"
}
Is it possible to retrieve the originally posted image ?
The image retrieved has to have the same checksum then the image posted
That's no 100% guarantee checksum is same, don't do that. Why? Because if you upload a .gif or .png image, Facebook would do conversion to become a jpeg image instead. So even though you upload a 1920*1280 .png image, what you can get is the modified version 1920*1280 .jpeg image. I have no idea facebook database would keep original image or not, but it's not what you can do using Facebook API.
I don't think you can get the exact, same image by the checksum that you uploaded to their servers. I would think that Facebook modifies them into certain formats so that the photo experience is consistent across the whole site.
That said, they could be keeping a copy of the original photo that was uploaded. But as far as getting access to it via the API or any other way, my best guess is looking at the 'source' according to the Facebook documentation on the Photo object:
The source image of the photo - currently this can have a maximum width or height of 720px, increasing to 960px on 1st March 2012
You can fetch it via the API by:
/<photo id>/?fields=source
Sorry it's not an exact answer, but I hope it helps.

Resources