Giter Club home page Giter Club logo

Comments (5)

saket avatar saket commented on June 9, 2024

Hi @ganfra. Can you share the full error stacktrace?

Can you also check what happens if you use SubSamplingImage() directly with your URI?

val zoomableState = rememberZoomableState()
val imageState = rememberSubSamplingImageState(
  zoomableState = zoomableState,
  imageSource = ImageSource.contentUri(…)
)

SubSamplingImage(
  modifier = Modifier
    .fillMaxSize()
    .zoomable(zoomableState),
  state = imageState,
  contentDescription = …,
)

from telephoto.

ganfra avatar ganfra commented on June 9, 2024

Hi, sorry for the late reply.
Here is the stacktrace :

0 = {StackTraceElement@30479} "android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:2013)"
1 = {StackTraceElement@30480} "android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1842)"
2 = {StackTraceElement@30481} "android.content.ContentResolver.openInputStream(ContentResolver.java:1518)"
3 = {StackTraceElement@30482} "me.saket.telephoto.subsamplingimage.UriImageSource.decoder(SubSamplingImageSource.kt:136)"
4 = {StackTraceElement@30483} "me.saket.telephoto.subsamplingimage.internal.AndroidImageRegionDecoder$Companion$Factory$1.create(AndroidImageRegionDecoder.kt:47)"
5 = {StackTraceElement@30484} "me.saket.telephoto.subsamplingimage.internal.PooledImageRegionDecoder$Companion$Factory$1$create$decoders$1.invokeSuspend(PooledImageRegionDecoder.kt:52)"
6 = {StackTraceElement@30485} "kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)"
7 = {StackTraceElement@30486} "kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)"
8 = {StackTraceElement@30487} "kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)"
9 = {StackTraceElement@30488} "kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)"
10 = {StackTraceElement@30489} "kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)"
11 = {StackTraceElement@30490} "kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)"

And yes, it fails the same way using directly SubSamplingImage

And this is expected, because ContentResolver.openInputStream only works with those defined schemes:

* <h5>Accepts the following URI schemes:</h5>
    * <ul>
    * <li>content ({@link #SCHEME_CONTENT})</li>
    * <li>android.resource ({@link #SCHEME_ANDROID_RESOURCE})</li>
    * <li>file ({@link #SCHEME_FILE})</li>

The URI I provide doesn't contain any scheme.
Like I said, Coil fixes this with his FileUriMapper.

from telephoto.

saket avatar saket commented on June 9, 2024

Gotcha. I don't mind supporting this, but is there a reason you're not specifying the file scheme? What's the benefit of writing "/path/to/file.jpg" instead of "file:///path/to/file.jpg"?

from telephoto.

ganfra avatar ganfra commented on June 9, 2024

I can also try to convert my path to a uri at some point instead, of course.
It was more a question about having "parity" treatment with regular AsyncImage, but it's up to you :P
I let you close the issue.

from telephoto.

saket avatar saket commented on June 9, 2024

Yea that's a fair point. Regardless of their validity, I will probably have to support them if ZoomableAsyncImage aims to be a drop-in. Let me sleep on this.

from telephoto.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.