question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add a method to pass an image thumbnail URL as placeholder

See original GitHub issue

There’re several use cases where apps shows a thumbnail image and onClick() it expands to a full sized image.

It would be a great feature to be able to easily smooth transition between those two states by calling:

Picasso.with(this).load(full_img_url).placeholderUrl(thumb_url).placeHolder(drawable).into(target);

In that case, Picasso would

if( thumbnail image available from local cache ){
     // that would be expected case
     // the thumbnail is already on screen, so it should be cached too
     use the image thumbnail as placeholder
} else{
    // and fall back in case anything happens
    use the supplied drawable as placeholder
}```

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

10reactions
Abdelhadycommented, Dec 7, 2014

It is a worthy feature for a better UX to show the thumbnail as a placeholder until the real image loads properly, & I’m sure that @JakeWharton & others who contributed to this great library can do this extra boost 😃 just using a url for the placeholder will be super great!

but using a nested calls like the following, I think it is not the best solution from performance point of view:

Picasso.with(context)
       .load(thumb) // thumbnail url goes here
       .into(imageView, new Callback() {
            @Override
            public void onSuccess() {
                Picasso.with(context)
                        .load(url) // image url goes here
                        .placeholder(imageView.getDrawable())
                        .into(imageView);
            }
            @Override
            public void onError() {

            }
        });
1reaction
rgr-myrgcommented, May 7, 2016

@abdelhady Your solution works perfectly. I’m able to load a thumbnail and subsequently a full sized image in sequence using your solution. Many thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use a thumbnail as a placeholder for Picasso - Stack Overflow
The trick here is to get the drawable from the imageView (which is the thumbnail) after the first call & pass it as...
Read more >
Possible to swap in a placeholder image globally for ...
I am wondering if there is a function I can add to functions.php to override this url, globally, with a url to a...
Read more >
Placeholder.com: Placeholder.com – The Free Image ...
Just specify the image size after our URL (https://via.placeholder.com/) and you'll get a placeholder image. So the image URL should look this:-.
Read more >
How to Create an Image Placeholder Service API with ...
This is where tools like Lorem Picsum and placeholder.com came in to give you a way to structure a URL to return an...
Read more >
Add an image in Numbers on Mac - Apple Support
In Numbers on your Mac, add and replace photos, create media placeholders, and add image descriptions that can be read by assistive technology....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found