Skip to content
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

upload component not work when img url has some params, example: show from aliyun oss #10102

Closed
didmehh opened this issue Apr 17, 2018 · 6 comments
Closed

Comments

@didmehh
Copy link

@didmehh didmehh commented Apr 17, 2018

  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

3.3.1

Environment

chrome 65.0

Reproduction link

Steps to reproduce

i got example from here, then add some params to url. not work.

What is expected?

show image

What is actually happening?

not show

@ant-design-bot
Copy link
Contributor

@ant-design-bot ant-design-bot commented Apr 17, 2018

Hello @didmehh. Please provide a online reproduction by forking this link https://u.ant.design/codesandbox-repro. Issues labeled by Need Reproduce will be closed if no activities in 7 days.

@didmehh
Copy link
Author

@didmehh didmehh commented Apr 17, 2018

i had provide another example for this issue.
then, i had resolve this issue by FileReader.
ps: i think the first link was clearly re-display for this issue. so, why need to reproduce again?
thanks.

@didmehh didmehh changed the title upload component not work when show from aliyun oss upload component not work when img url has some params, example: show from aliyun oss Apr 17, 2018
@afc163
Copy link
Member

@afc163 afc163 commented Apr 17, 2018

Did you mean the image url "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png?time=20180417" will not display image correctly?

@didmehh
Copy link
Author

@didmehh didmehh commented Apr 17, 2018

yep

@afc163 afc163 closed this in 3b00cf8 Apr 17, 2018
@xiaoxiaosaohuo
Copy link

@xiaoxiaosaohuo xiaoxiaosaohuo commented Apr 19, 2018

I update antd to 3.4.1 ,but this problem is still exist .I check the node_modules of antd, the source code is not update.

@didmehh
Copy link
Author

@didmehh didmehh commented Apr 19, 2018

hi guys, my antd version still at 3.3.1.
i had resolve it by parse remote img to base64.
for example:

function base64Url(url, callback) {
  let xhr = new XMLHttpRequest();
  xhr.onload = function() {
    let reader = new FileReader();
    reader.onloadend = function() {
      callback(reader.result);
    }
    reader.readAsDataURL(xhr.response);
  };
  xhr.open('GET', url);
  xhr.responseType = 'blob';
  xhr.send();
}

const url = 'http://img15.3lian.com/2015/f1/38/d/41.jpg'
base64Url(url, (result) => {
    console.log("result base64 url was", result)
})
@shaodahong shaodahong mentioned this issue Oct 15, 2019
1 of 14 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants