Web image display in iPhone app - uiwebview

I am new to developing on the iPhone so am sorry if this is an easy question, but it has had me stumped for a little while.
Basically the app displays data retrieved from an XML feed. In that feed is an element that contains the path to an image. eg http://www.myserver.com/myimage.jpeg.
I want to be able to display that image in the list view of my iPhone app.
Most importantly, I don't want to stop the list drawing for each image, the rest of the data should be displayed immediately and then each image downloads and displays as quickly as data speed etc make it available.
What is the best way of downloading that image and displaying it?
Ideally can someone point to some working example code.
Thanks
Stephen

Displaying the image: you could create a UIWebView and just point it to the path - and then it's fully zoomable too.
Displaying in the list view:
//Somehow download your image...
cell.image = Your Image

Related

How to force to show image orientation?

I'm using multer node and express to upload a image to my app. But some images shows rotate 90 degrees when it's on the client.
why is this happening?, how can I fix it?
By the way I'm using vue on the client and for the upload process, of course I use formdata
UPDATE
After research and comments from the guys above, its a EXIF problem. Any code ideas to solve this?
The behaviour you are experiencing is probably caused by the Exif Orientation metadata.
There is another question here on Stackoverflow about this problem: JS Client-Side Exif Orientation: Rotate and Mirror JPEG Images
The selected answer points to a project called Javascript-Load-Image as a possible solution, that basically means you will have to take the orientation in consideration when rendering the images to get a consistent behaviour.
Another possible alternative would be to edit/remove the orientation metadata in your backend.
Check the following resource for more information:
JPEG Image Orientation and Exif
This is most likely caused by Exif metadata (just like #Romulo suggested).
Browsers ignore Exif metadata when displaying images and that's why you're getting this behaviour.
To check that this is related to Exif take 4 pictures with different phone orientation (landscape left, landscape right, portrait, upside down). One of them will be shown properly, while the other 3 will be rotated. (Also note that if you're using the front camera, the image will also get mirrored).
Not all camera phones do this, but iOS does it consistently. The reason for this is performance. When rotation the phone the sensor also rotates and the picture taken doesn't take the rotation into consideration.
To properly show the photo, the image needs to be rotated, but if you just change the Exif metadata then you don't need to do it. Of course, any client that shows the image needs to be aware of this information (and iOS Photos and such are aware).
This has nothing to do with multer, but with the images are stored.
The bottom line is that you need to rotate the image to compensate for this.
Take a look over this npm package to adjust your image on the server side.

Mapbox GL JS : Do large images overlay accurately - if so, how?

I feel like I have been stuck perpetually with this problem. I have a single geoTIF file of weather radar data that will not overlay on Mapbox correctly. The spatial area is of the entire US. It should be a simple task, but there seems to be some sort of weird distortion causing the overlay to not be correct, even though I am very certain my Mapbox coordinates in the linked HTML file below are correct and match the geoTIF.
I uploaded the geoTIF to a website called "geotiff.io" (which uses leaflet to show the files) and it renders the image perfectly, but I cannot emulate it using Mapbox. The storms always are off in Mapbox.
This is a link to my Mapbox map with the image overlay where it is incorrect
This is a dropbox link to a zip file with the geoTIF and colorization file, which I used gdaldem with
I would like to explain more, so it's simplified. Here is an image showing part of a storm that is out of place (left side) and how it is too far north. On the right side was a screenshot taken from geotiff.io - and how it's perfect. What is going on here?!
The geoTIF image was not set as a web mercator projection before being displayed in Mapbox. I assume the geotiff.io service corrected this automatically and made me think there was an issue with the code or Mapbox, when it was not.

Images in J2me Lwuit

I have developed an LWUIT app. I have two types of images dispayed in the app. One coming from server side that need to displayed (like a photo posted and saved to server side) and one packaged in my jar and displayed mainly as icons (like a music icon, loading animation gif etc). I need to display all images according to the sreen size and resolution. The first kind is displayed by taking the screen display height and width and then use scale method and show a scaled version of the image. But however I have no idea how to show the second kind. i.e. icons. Example, my loading image looks good in most of the phones but for some phones like samsung, it looks blurred and over-sized. How to do this. My basic idea is to keep 3 types of images of icons like icon_width_lowXheight_low.png, icon_width_mediumXheight_medium.png and image_width_highXheight_high.png and show it based on the screen size. Please let me know the bets way to achieve this?
Thanks,
Parvathy
You should use MultiImages which were added in LWUIT 1.5. I don't have a link for this in LWUIT but our work in Codename One is pretty close to this so check out the How Do I? on multi images (and I suggest migration to Codename One regardless).
I think that you will need to use this
Image i = Image.createImage("your image path here");
i = i.scaled(widthValue, heightValue);
And put this values in relation to the Display.getInstance().getDisplayHeight() and Display.getInstance().getDisplayWidth()
Right?

Can I Capture phone screenshot using j2me app?

I am trying to develop a wireless phone projector, wherein I will be showing phone screen on projector using a projector connected PC.
I am bit confused on how to capture screenshot of any running application in j2me.
Can you help?
Just want to capture screenshot in j2me
I'm not really sure of what you wanted to do but if you are thinking of a way for your app to get a screenshot of its screen then what I can say is that you can and cannot do it. Why you cannot do it? Say your using a canvas in creating your screen. I think there isn't a way of converting the Canvas to an Image. The Canvas is limited to just drawing itself on the phone screen. But, like what I have said earlier, you can also create a screenshot of your app screen. What you need to have is an Image object over your Canvas. Why Image? It is because the Image object can be converted to an image file. And the image file will be your screenshot. But, of course, there should be something that dynamically creates the image source for the image object on the canvas.
Image myScreen = Image.createImage(createScreen());
A method that creates the screen:
InputStream createScreen(){
//dynamically creates the source of the screen
}
You can have a screenshot using myScreen. The drawback here is that rendering is quite slow. This is possible but I think this is kind of difficult to implement.
With this snippet code you can take a "screenshot" of the Canvases in your app:
public Image getScreenShot() {
Image screenshot = Image.createImage(getWidth(), getHeight());
Graphics g = screenshot.getGraphics();
paint(g);
return Image.createImage(screenshot);
}
Add getScreenShot() to any canvas that you want "screenshot" of it.Then you can get it's RGB and convert to byte[] and pass it on the network.
References:
developer.nokia

User uploaded images drag/drop to a Raphael SVG then resize, rotate and fill path

This may be a bit long, but thank you in advance for any assistance.
I am trying to develop a web app that will allow the user to interact with a wireframe 'drawing' of a chosen product and customize each path with either an uploaded image, color/pattern or add whatever text...or all, if they choose (something similar to customizing a greeting card)...for THIS question, I will start with the image part....
Here is what I have so far: http://jsfiddle.net/rednevednav/C9aDm/
What's the most effective way to able to use any image...one that has been uploaded by the user...to append the fill of a selected path and then be able to drag it around, resize it and rotate BEHIND the selected path (so they can control the part of their image that gets 'cropped'? (*Note: I've searched for months and haven't found anyone else doing this outside of Flash....MyPublisher.com gets really close, but it's all squares and no SVG...I've looked at using ImageMagick and 'dst_in' on the server side...but after hard coding an image into svg...like on my jsfiddle...it seems that this could be done client side)
Should I be using Raphael for this application in the first place? Or?
**Hoping to stay within the Raphael framework (if using at all) in order to maintain the IE support afforded out-of-the-box that it provides; I understand that too much java hacking kills this. Of course, the 'finished' product will need to be downloaded as a .pdf....but that's another question for another time.
EDITED: # Thanks to an answer to my question HERE, I've update my JSFiddle with how to get URL from an uploaded image and use to fill path in Raphael paper. So that leaves 2 questions on this subject that I'm still struggling to resolve:
1. How to use this uploaded image to be able to drag and drop onto path to update fill?
2. How to first select which path I want the uploaded image to fill? (for when drag/drop is not available)
Thank you again in advance of any assistance!

Resources