dynamically load images on scrollview - uiscrollview

Is there any efficient way to load images on scrollableview dynamically in Titanium Appcelerator? I want to load 200-300 images on swiping the scrollableview.

this is the cleanest solution I have seen so far as a starting point. The approach I took for my application requires some refactoring before I post it.
https://gist.github.com/810171

Related

How to lazy load images in a scroll view

I want to show a scroll view that has fairly large number of thumbnails. eg: https://cdn.vox-cdn.com/thumbor/sddJ5KHoGDbZfx8jcNey4iahmu0=/0x0:1395x1171/1200x800/filters:focal(587x475:809x697)/cdn.vox-cdn.com/uploads/chorus_image/image/57064313/Screen_Shot_2015-09-07_at_9.11.34_AM.0.0.png
I want to load the view as fast as possible without delaying it until all images are loaded. This essentially means I need to lazy load image content. While each image is downloaded, a placeholder image (fetched locally) should be shown. I certainly know how to do this from scratch, but wanted to know if there are standard solutions available. Can I setup Xamarin.Forms.Image class to get this behavior?
Is there any particular reason for which you want to use a ScrollView specifically ?
From what you're describing, it looks like you should actually be working with a ListView instead (which will improve performance by a LOT if you have a large list of images).
Then, like #SushiHangover said, there is FFImageLoading that can help you work with these images, or you can create you own Image class, to implement a custom solution on both android and iOS.
Glide is a faily easy to use solution for Android, and SDWebImage is also a good solution for iOS.

How do I make above-the-fold content load first on my website? (control the load order)

My website for architectural visualization: http://www.greenshell3d.com
I noticed on the networking tab / incognito it takes 15 seconds or so to load the above-the-fold content. (most notably the image slideshow.)
Some of the images in the slideshow load at the very end instead of the beginning of the website load process. Now I understand the browser handles this order, but perhaps there is another way. As it stands, the bounce-rate is too high and I expect it is because of load time.
I've seen a jquery snippet on github that allows one to control the order of image loads - do you think this is a good option? I'd be glad to hear any opinions before investing the time to fix this.
Any ideas? Thanks!
You said you are interested in any opinions as well, so first some general thoughts: There is no page fold. The web that we produce content for exists in so many different screen sizes + resolutions that it’s impossible to say "The fold is below this big image!". Yes, Google changed the pagespeed insights tool to make people load stuff on top of the page first, but I think their wording there is really bad.
Now to your image loading issue:
The first thing I would recommend is to reduce the size of all the images. They seem to be around 280 - 300 kb per image and you have a few of them. Since there is a translucent overlay over them anyways you can probably get away with reducing the image quality without people noticing it (because they don’t see the image directly). Play around with the values here.
I would then look into optimizing the code for the slider to load the first image first, then the rest of the page and the other images asynchronously maybe after that. Another trick could be to increase the slide fade time from the first slide to other slides so the slider doesn’t change if the next image isn’t ready yet. You said you found a jQuery script to implement that, that’s where I’d start.
As a general guideline: the position of requests in the source code usually determines the load order of things on the page. If your images are requested by JavaScript at the end of the page, that lead to the images being loaded later than you want them to be loaded.

Stitching multiple images into one SL / WP7

I am trying to download a number of images, of differnet sizes, then after some cropping stitch them into one single image.
I am intending to do this in code on a WP7 device
My current approach uses n Image controls and waits for their ImageOpened events to fire. Once they have all been successfully opened I create a new Image for each and stick them into a StackPanel.
In then use WriteableBitmap to create a single image from the stacked images.
This code works 40/50% of the time. The rest of the time the layout engine decides to not bother laying them out in a horizontal stack. All the images get rendered on top of each other.
Is there a way of forcing the StackPanel to do a full layout pass? I have tried combinations of Arrange and Measure on both the Images and the StackPanel.
I found the article WP7: Generate Live Tile Images Locally (Without The Visual Tree). I am now using Henry Chong’s approach (which includes UpdateLayout) and my photo stitching is working great.
I cannot help but be amused by the fact that the answer to my question “how the hell do I force the layout to be updated” was answered with a method called “UpdateLayout” [dev exits stage left kicking himself]

Time loading webpage

I'm trying many problems with the time loading of my web page:
www.alvaromillan.es.
I've tried to minify the js and the images but the problem is, as you can see, that my web site is only this page so every image and js is on this document...
The loading time is really high and even the smooth scrolling movement lasts a lot and the first time you use it it doesn´t go fine...
Please may any of you help me??
I took a quick look at the page just using the chrome developer tools and while there are probably several things you can do which YSlow would suggest, I think the biggest gain would come from optimizing and spriting your images. 131 of the 156 requests on your page are for images. Thats alot of images and many are fairly small. Also alot of the images seem quite large in bytes for their size. Here is what I would do:
Combine the images using several sprite sheets about 50k-100k per sheet.
Use the PNG format.
Quantize the sprite sheets to 8bit PNGs. My guess is that you will not experience perceptible quality loss by doing this. You could use spmething like pngquant to do this.
Use something like optipng to apply lossless compression on the quantized image.
I think this will yield dramatic improvements.
As skaffman suggests, do run yslow and/or google page speed test for more thorough suggestions. I also like using webpagetest.org which provides great metrics for optimizing pages.
Give the YSlow Firefox plugin a try. It will analyze the load times of your site and advise you the best course of action to take to fix it.
OK, here's some quick initial thoughts...
Flush the page after the head so that the browser can start downloading those resources sooner.
Remove the iframe
jquery appears to be loaded twice - once directly and once via google.load
Can you defer the loading of the javascript until later e.g. put it at the bottom of the page or load it asynchronously?
Rather than preloading the slideshow images - why not load them on demand when clicked on, or lazy load them after the page has finished load?
Also do you really want IE to emulate IE6???

Rotating a set of images

I am trying to setup a "rotating image" for part of a site I am working on. I have taken many photos of a single item (30+), and I want to display them like it is a rotating 3D image (with a possible draggable speed).
One approach I have taken is setting it as a CSS background, and looping through the images every 0.1s. It works alright, but it flickers like crazy until the image has done a full rotation (I am assuming this is because the image is not yet cached)
Has anyone implemented something similar or have a suggestion?
Much appreciated.
jQuery Cycle is an amazingly versatile, light-weight, jQuery plugin.
http://jquery.malsup.com/cycle/

Resources