LiveCode mobilePickPhoto- Can't load some images from library - mobile

I can't seem to load some of the photos from the mobile library to the card using mobilePickPhoto "library".
set the lockloc of the templateimage to true
set the width of the templateimage to "300"
set the height of the templateimage to "400"
set the left of the templateimage to "50"
set the top of the templateimage to "10"
mobilePickPhoto "library"
if the result <> "cancel" then put the last image into image 1 of card 1
I'm not sure why but is it due to the size restrictions set? May I know how can I allow upload of any images with different sizes?
Really appreciate if anyone can help me out. Thanks.
Using LiveCode 6.7, testing on Sony Xperia (Android).

Related

Next JS + Image optimization

I've got this ticket thats asking me to "frond-end optimize image size, dimension, quality from code"
the images are user uploaded in binary format? and I retrieve them + load them on the page using the API link they give me for that page.
Image size, dimension and quality -> I can set dimensions easily, change the images from jpeg to png where needed like such
<img
src={`data:image/jpeg;base64,${
data.images ? data.images[0].imageData : ""
}`}
className={styles.headerImage}
/>
But what else can I do for images?
Is it possible to crop images on the front end before setting it as say - a mobile or tablet bg picture?

Mapbox Icon-Image Dynamic Symbol (icon) Loading with Sprite

I am trying to do something I feel is very simple, yet seems that I am clearly misunderstanding a crucial piece of the mapbox addlayer feature.
The Goal
Create dynamically identified icons, based on a features data value (e.g. geojson feature data vale title: "walmart"). Essentially just adding dynamic store icons from the sprite image when those locations are queried via tilequery. picture representation here
The problem
I keep getting an error when trying to use the sprite values from the style. Error: util.js:349 Image "airport-11" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.
I see tons of resources talking about sprites, but none discuss how to exactly implement them in this fashion. I have even tried querying the sprite and then adding the values using dot notation to access sprite values. This gives an error of "undefined" and invalid value.
Example code:
map.addLayer({
id: "tilequery-points",
type: "symbol",
source: "tilequery", // Set the layer source
layout: {
"icon-image": [
"match",
["get", "title"],
["HEB"],
"H-E-B_logo",
["Pilot Flying j"],
sprite.Pilot_Travel_Centers_logo,
// "Pilot_Travel_Centers_logo",
["Dollar General"],
"Dollar_General_logo",
["Cumberland Farms Corp"],
"Cumberland_Farms_logo (1)",
["CEFCO"],
"CEFCO-convenience-stores-Logo_510px",
["BJs Wholesale Inc"],
The Question
How do I access the sprite values and not get an error?!!!
Thanks for the help! I Wouldn't ask if I didn't need it!
UPDATE
I have figured out that to use sprite images inside of any layer, the images will automatically be available if you have them in your Mapbox studio sprite image collection. The confusion was that previously, I was not able to use them from link. However, it should work automatically.
Hope it helps!
It's true the documentation about sprites is not super clear. I'll try to summarise (simplifying a bit).
A Mapbox GL style has one sprite. That's a PNG containing all the icons, plus a JSON file specifying what each icon is called (its icon ID), and where it located within the PNG. The sprite is specified by giving a URL as the sprite property: https://docs.mapbox.com/mapbox-gl-js/style-spec/sprite/
You can also add images to the sprite dynamically after the map loads, with map.loadImage and map.addImage, specifying the icon ID.
To display an icon, you use that same ID in a symbol layer: "icon-image": "myicon".
You can run into trouble when you try to combine your own icons with those in a Mapbox basemap (which are Maki icons with names like `airport-11').
To combine them, you can do one of these three things:
upload your icons to a style in Mapbox Studio
load your icons dynamically
generate a new sprite sheet offline, using something like mbsprite
I don't know what you meant about "dot notation", but no, that's not the right path.

How Next.js new Image component detect device size if layout prop value is "responsive"?

On desktop, it detects the current viewport size correctly, but if I simulate mobile view on Chrome Dev Tools, the Image component detects the wrong device size.
I'd like to know how the Image component detects device sizes.
The "Image" component doesn't detect device size. It generates an <img/> with preset srcset attribute. The browser reads this value and loads an image of appropriate size for the current viewport (see article).
You may see inconsistency in DevTools because of caching. If the browser downloaded a larger image and then you downsize viewport and update page, it still would retrieve the cached image for "wrong" viewport.
Hard reload won't be enough. Try to use "Clear cache and hard reload" after switching viewport size.
You can specify a list of device width breakpoints using the deviceSizes property. These widths are used when the next/image component uses layout="responsive" or layout="fill" so that the correct image is served for the device visiting your website.
module.exports = {
images: {
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
},
}
See also: https://nextjs.org/docs/basic-features/image-optimization
You need to check your devicePixelRatio.
I also got confused when the image that got loaded is always twice the size of my viewport.
I think the browser decide to load the image that is nearest to viewportwidth * devicePixelRatio in my case devicePixelRatio = 2.

iOS 12 and SceneKit: Node showing up in White

The application we had have been using SceneKit for a while and never had any issues with it until recently. Compared to earlier, now the render doesnt show the node in there actual color. Please see the images attached for more detail. If anyone has a solution to it then I would highly appreciate it.
iOS 12
https://image.ibb.co/i9sVGp/PNG_image.png
iOS 11
https://image.ibb.co/bBRCU9/IMG_0145.png
I had a similar problem in an app that downloads OBJ and MTL files with their texture images and renders them. All image texture materials were just blank white.
In my case, the problem was solved by manually disabling the emission property on the model's materials:
for (id object in self.modelNode.geometry.materials) {
((SCNMaterial*)object).emission.contents = [UIColor blackColor];
}
I have no clue why the emission component was set at all and why this changed with iOS 12/13.
I fixed this by changing the 'Emission' property from white to black under the material settings in xcode. Save the file as a scene-kit file to avoid having to deal with it
Select the model
Go to the panel on the right
I was able to solve my issues for the moment by choosing OpenGL ES as render mode:
I was able to solve this issue by setting the following properties:
self.scnView.pointOfView.camera.wantsHDR = true
self.scnView.pointOfView.camera.minimumExposure = -1
self.scnView.pointOfView.camera.maximumExposure = -1
Apart from these properties, you can also set
emission and lightingmodel geometry properties of your node.

how to adapt my cocos2d-x app on iphone 5

My game is designed with cocos2d-x, the picture resource size is 320x480, which is adapted to iphone4, now I want my game adapt to iphone5, what should I do?, thanks!
It actually depends on your current cocos2d-x version and the resolutions you're planning to support. But basically if you're running the latest stable release (2.0.4) and you only want to support iPhone4 and iphone5 resolutions then you have to:
create the art for both resolutions (this is not mandatory but the graphics might be scaled too much and lose quality).
define at runtime the DesignResolutionSize and ContentScaleFactor based on the actual device's resolution
select the correct resource path
Here a simple example on how it can be implemented:
// Get the real screen size
CCDirector* pDirector = CCDirector::sharedDirector();
CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
pDirector->setOpenGLView(pEGLView);
// Set the design resolution. Please see the doc for the different modes
pEGLView->setDesignResolutionSize(480, 320, kResolutionNoBorder);
// Here you have to chose between width or height depending your game's design
if (frameSize.width > 480) {
// iphone5
pDirector->setContentScaleFactor(1136/480);
CCFileUtils::sharedFileUtils()->setResourceDirectory("hd");
} else {
// iphone4
pDirector->setContentScaleFactor(1);
CCFileUtils::sharedFileUtils()->setResourceDirectory("sd");
}
/// Now load the sprites....
If you're want to support more iOS/android resolutions please refer to the following links for fullscreen multi-resolution solutions offered by cocos2d-x:
http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Multi_resolution_support
http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Mechanism_of_loading_resources
Hope it helped.
Cocos2D-x 2.0.4+ have very easy solution for multi-resolution problem. ( either iDevices or Android devices.)
In fact you just need to set your DesignResolution and then just imagine your target device will has this resolution.
If target device really has this resolution ( or some other but with same ratio) cocos2d will handle to fix screen and your game looks same in all devices.
And when ratio of target device is different, you have many option ( as cocos2d language, policy) to manage that.
For example if you use Exact fit policy, cocos2d will force your game ( and design) to fit target device screen (without that black boarder).
Exact fit
The entire application is visible in the specified area without trying
to preserve the original aspect ratio. Distortion can occur, and the
application may appear stretched or compressed.
For more detail just take a look at this link : http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Multi_resolution_support

Resources