-
Notifications
You must be signed in to change notification settings - Fork 570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Image is displayed in browser, but doesn't come through with download (Safari) #348
Comments
Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can. |
Hello Yehuda! Hope it helps! |
how do i test that out tho, if the error only happens through safari, or other mobile os? Is there a way to just add a fix assuming the issue is with cors? |
|
Also what do you mean through server configuration exactly. |
I am not sure what that error means exactly as I tested it in Chrome browser and it shows a CORS error. Maybe you should checkout if that error is related to CORS. |
Facing the same issue here. I'm getting a cors error. @pabloiea1995 I currently don't get your fix. |
You get the error on mobile only or also on desktop?
…On Mon, Dec 19, 2022 at 9:49 AM labaran1 ***@***.***> wrote:
Facing the same issue here. I'm getting a cors error. @pabloiea1995
<https://github.com/pabloiea1995> I currently don't get your fix.
—
Reply to this email directly, view it on GitHub
<#348 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AWAMRKY56IBS2DPQBIJTM5DWOBYXPANCNFSM6AAAAAATAKQYQM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Desktop. Using Ubuntu 22.04.1 LTS chrome. |
how did you see what type of errors it was on mobile safari? Like I can't figure out how to inspect or see errors with mobile safari |
Okay, my bad. I mean the issue is also on safari mobile. but, if you have a mac, you can use the web inspector. Go to settings on your phone, then safari, then toggle Web Inspector.
|
So I think the issue is with safari, not just on mobile. Just use safari on my mac and it downloads all the html besides the image, however the image is previewed in the browser. I checked and there are no errors. The network tab shows a 200, what's even weirder is that when I look at the data when I download the html as png, in the preview tab it shows the image I upload, but doesn't come through when I download the html. |
before the cors error, I experienced this same issue with chrome. |
Have you seen the same error using safari? Also what was ur fix?
…On Mon, Dec 19, 2022 at 12:41 PM labaran1 ***@***.***> wrote:
So I think the issue is with safari, not just on mobile. Just use safari
on my mac and it downloads all the html besides the image, however the
image is previewed in the browser. I checked and there are no errors. The
network tab shows a 200, what's even weirder is that when I look at the
data when I download the html as png, in the preview tab it shows the image
I upload, but doesn't come through when I download the html.
before the cors error, I experienced this same issue with chrome.
—
Reply to this email directly, view it on GitHub
<#348 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AWAMRK2OTO24IJPAJEKPL6TWOCM5BANCNFSM6AAAAAATAKQYQM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I've not fixed it yet. It's a ticket I'm working on.
|
After going over the issue more, it's definitely limited to safari. |
I am facing a similar issue, I tested the library with Chrome on iOS, and The behaviour is the same as safari on iOS. If anyone has a fix for it, I would greatly appreciate it. 👍🏻 |
I have the same issue with desktop safari, as well as with safari on iphone.
…On Sat, Dec 31, 2022 at 1:20 AM Dhruvil ***@***.***> wrote:
I am facing a similar issue, I tested the library with Chrome on iOS, and
The behaviour is the same as safari on iOS.
The issue is only on iPhone. as I tested with Android, and Desktop, I got
good results.
If anyone has a fix for it, I would greatly appreciate it. 👍🏻
—
Reply to this email directly, view it on GitHub
<#348 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AWAMRK32SUWTYBVNPCEMAILWP7GC7ANCNFSM6AAAAAATAKQYQM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Same issue. Bug appears in safari on iPhone and desktop. |
Used html2canvas for now, and rendered the dynamic content on the page until the image is created, once the image is created, removed the dynamic content from a page. Through this process, I was able to get good results on iPhone (Safari and Chrome) and Android. Although you have to sacrifice on performance. Now, a 1080x1920 Pixel hi-res image takes anywhere between 2-7 seconds. |
@dhruvilxcode hey! Can you please tell me how you overcame this issue with ios safari? |
@minusmo I replaced this library with the html2canvas. what I did is rendered the content on the page by inserting the dynamically generated content then I called the method to convert data to base64 image. once image is generated I removed the content from page that I added previously programmatically. The implementation really depends on the usecase. and I found that if content is available on the page (not dynamic content) then these libraries works well. |
The problem seems to be a bug of |
How can I implement that instead of this package? Yours is typscript, can't figure out how to replace this function with that. |
your issue was also exclusively on Safari? |
I have the same issue with iphone mobile, the android mobile and pc browser web are all normal. |
Hi! I also had the same issue with safari when I used html-to-image https://www.npmjs.com/package/html-to-image. I solved it with another library html2canvas https://www.npmjs.com/package/html2canvas. I have converted the html to image in this library and rendered them in @react-pdf/renderer. Here is my code: function to convert image
this data i convert to image And here I render my image in pdf.
Hope it will help. |
Did you figure this out? Ironically I'm trying to migrate from html-to-canvas because of issues with nested images inside SVGs. |
I switched to this lib: https://github.com/qq15725/modern-screenshot |
Thanks @s-kris you've saved the day with that, much appreciated. |
Oh! I didn't know the font issue. But glad it helped you. |
Thanks your solution worked with me. Another way might help is to download the image before add it to the dom that being converted into an image. |
greate, thank for sharing solution |
Expected Behavior
I'm trying to download html including an
img
tag using safari, but the source doesn't show up, just an emptydiv
.Current Behavior
I have a preview box:
When I download the image I get all the html besides the picture; instead just an empty div. where the image should be. All other parts of the html convert and download as a PNG, so I'm confused as to why the only issue is converting the
img
, especially when theimg
is being displayed in the browser. I'm wondering if this is a react issue, or just an issue with downloading images of animg
.Possible Solution
I'm not sure what's causing this, maybe it's an issue with my set up or css, but it doesn't really make sense to me. Someone mentioned in the comments that it may be an issue with CORS; I checked the network tab on safari when I hit download and there are a few things that come up:
The bottom is the png file (my static file) that is displayed in the browser but not when I download the html. Here it is displayed as a png, headers read 200, status okay.
Next up is an svg of the entire downloaded html. Inside the network tab, the svg file shows everything even the static png that doesn't show up in the downloaded html-to-image. Headers also read 200.
Next is an xhr, looks the same as the first png. Also 200.
The top 3 are all 304 not modified.
I'm pretty new to coding so all of this doesn't really make a lot of sense to me.
Steps To Reproduce
Best way to reproduce this is to just use the code example I gave and replace the
src
with any photo you have locally or online. I tried downloading with local photos and with google photos/gifs online and both ways come back with an emptydiv
. I think it's important to state again that the images are displaying in the safari browser, they just don't get converted from html to PNG.Your Environment
Since this is only happening to me in safari, I can't help but think it's not an issue with my code. Of course it could be -- I am setting my
img
with a reactsetState
and having thesrc={require('')}
but again, since theimg
displays in the browser, I can't help but think it's just a bug. Would love to help more, just not really sure what's causing the issue.The text was updated successfully, but these errors were encountered: