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.
Related
I use MvxImageViewLoader for MvvmCross Xamarin applications.
This component is really great and simplifies the images loading pretty much, but it (at least, out-of-the-box) is pretty basic and most of modern applications require some reacher functionality, for instance, loading/progress images or images nice appearing/transitions (possibly with custom animation).
I see there is DefaultImagePath property, but that's static image, which I can probably use by default, but that's not animated view or something.
So, is there any way to customize/extend the loader behaviour (for default image appearing, images transition (from default to loaded)) etc?
And also I've noticed that the loader caches the image and even if I trigger bound property changing (leaving the image url the same) it does not refresh the image. I guess, "caching" really means caching and so on, but what if I need to change the user icon or something... how can I forse the cache refreshing with the image loader?
Thank you!
So, is there any way to customize/extend the loader behaviour (for default image appearing, images transition (from default to loaded)) etc?
No - advanced features like fade-in/fade-out/animated-placeholder display aren't supported within the standard MvvmCross image view, and no-one that I know of has provided any samples or tutorials about how this can be done.
For adding such functionality, you can use normal software techniques - inheritance, aggregation and cut, copy, paste. e.g. you could simply create your own AgatImageView which had the behaviour your app requires based on MvxImageView.cs.
Some examples of creating your own data-bound controls is given in N=18 and N-19 of http://mvvmcross.wordpress.com/
As you already mentioned in upper comments you may use default iOS' UIActivityIndicatorView for showing progress and you should hide the progress in afterImageChangeAction, you can check if UIImageView.Image field is not null, to make sure that the image is loaded.
Regarding the caching, it's not that easy here. By default MvxImageViewLoader relies on MvvmCross framework's implementation of IMvxFileDownloadCache interface. This interface has only one public method RequestLocalFilePath(), so even if you get an instance from IoC container (Mvx.Resolve()) you won't be able to clean-up the existing cache (to do that you need to reset private _entriesByHttpUrl field of MvxFileDownloadCache class).
If you really need this, you have to copy-paste existing MvxFileDownloadCache class and make your tweaks. But I am not sure about your use-cases where you need this. If you download images from the web, the URL of the image is a sort of a key in the cache, so if you need to reload just change the URL.
Maybe you could use some old-school approach like adding GET parameters to the URL: http://mydomain.com/images/myimage.jpg?timestamp=123456. Usually this helps everywhere :-). Although I didn't test it with MvxImageViewLoader, it's just my best guess.
I have an image of a living room, which I'm turning into a menu for a new site I'm working on. The idea is that you can click on certain items in the room, like a chair, desk, couch, etc and get taken to the desired page. I'm wondering if there is a clever way of doing this. Since the items are not simple shapes, I don't want to use a standard image map.
Thanks for you help!
I'm answering because a Google search brought me here...
Because you asked for a tool:
GIMP Has a really good Image map creation function.
Open your image in GIMP and select Filters > Web > ImageMap
From there you can create image maps by drawing on the image. Saving will generate HTML you can then tailor to your needs.
This tool looks to be a solid image mapper: http://www.image-maps.com/
I'd suggest doing this with a canvas and SVG's, it would make this quite a bit easier, and more professional.
As Korvin mentioned, doing this in SVG is probably the easiest option, because you can attach events to objects in SVG rather than having to manually specify a particular area in which to listen for events.
If you go this route, I recommend using the RaphaelJS library which has a nice syntax and the advantage of working in IE pre version 9. Here's a demo which, although it uses onmouseover instead of onclick, it might be close to what you're trying to achieve:
http://raphaeljs.com/australia.html
So currently I am able to display images via URL's using QLabel, QNetworkManager and QPixmap. And then to display the image I use something like label->show(). Essentially I follow the same steps as in the pseudocode in this link:
http://developer.qt.nokia.com/forums/viewthread/7010
Now I am still somewhat new to Qt and am having difficulty extending this. What I want to do is be able to display multiple images from different URL's into essentially the same container. So basically I want to see two images in the same container/window. These images are specified by their width, height, x position and y position in the main window/container. I know that I should use widgets but I am not sure what exactly should I use? QFrame? QHBLayout? QScrollArea? etc. Any help would be appreciated.
You can use many QLabels inside a Layout to get the effect you want. The way you want to lay it out is up to you, and there's more than one layout manager. There's things like the grid layout, the box layout, etc. Have a look here for layouts. You can look at it in this simplified way:
One window has a layout and a layout has many items in it.
http://doc.qt.nokia.com/latest/layout.html
In reality widgets can contain many other widgets. To position them properly, you use the layout.
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
im building a webshop in Drupal and i was wondering if you could help me with the following problem:
I got one big image frame (500x500) and 5 little image thumbnails(95x95) underneath the big one.
How can i realise that if the visitor clicks on the thumbnail, the big image frame gets filled with that specific image?
jQuery is the right direction, but the strength of Drupal is based on doing things "the drupal way", which means, I guess in your case, to use Views as the origin for the thumbnails using imagecache + lightbox, and somehow change the main "frame".
I used jcarousel in some cases (for different but similar uses) and it works nice. I guess it is possible to trick it to do what you need, or - better - to find an existing module that do what you want.
I know, many Drupal buzzwords, and a stiff curve to overcome, but this is the right direction in case you want to base your site on Drupal.
If you don't need all of these, and want a static page+jquery, Drupal might be an overkill altogether.
If you use Views, Imagecache, and the Lightbox2 module, you can create image galleries out the arse and tell it to link the field to its large size and use Lightbox2 as the method. This is how I do most of my galleries.
Drupal uses jQuery so you can write a simple jQuery script to handle this (not sure if there's already a plugin to do that). Just add all the img tags (make sure all of them except the first one are hidden[display=none]). Then when a thumbnail is clicked/hovered do a $(big_img_holder).replace() with the tag for the image to be shown. Tell me if you want to see some code and I'll try to show you.
You can see this plugin as an exapmle. Just replace the numbers on the right with thumbnails and you're ready to go ;-)