-
Notifications
You must be signed in to change notification settings - Fork 905
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
Add ability to upload binary assets (images, etc) #45
Comments
Totally — we're working on allowing upload of binary files, should land sometime later this month or in Sept :) |
+1 |
Incidentally, some kinds of binary assets already arrive intact and are served correctly, when you create a StackBlitz from a GitHub repository. |
@kylecordes good eye- we support all static assets for imported github repos right now. We're currently on track to ship static assets by mid-late April; I just posted in #72 (comment) with more info as well. |
It is certainly an easy-ish workaround for anyone with an urgent need for asset serving. Grab your assets, put them in a GitHub repo. Fork that repo and continue all of your local code edits, no problem. |
SVG is not binary, isn't it? But it is not allowed beeing created. Anyway Material Angular has SVG files in their StackBlitz examples: but they cannot be loaded: 😢 |
Will get SVG enabled for vendor assets. Thanks for letting us know about this! 🍻 |
+1 |
This apparently remains outstanding despite bold and old predictions and stated intentions made in this thread and elsewhere. You are able to drag and drop binary images ( There is no informatation about this limitation in the docs. |
I have import my project from github [with image] but it does not load images https://stackblitz.com/github/kumaresan-subramani/stackblitz-test WHen can we get support to upload |
I still can't find "assets" folder in angular project. I've issue now as I need to add some static files (mp3 music files as they can't stream from github or some other location) and without which my demo is not going to work. Please look into it. |
Guys, how can I make PWA when Stackblitz isn't supporting static files? Because of that I can't store service worker in my project (it's ignored after being uploaded to Firebase hosting)... Maybe there is a workaround? |
What's the status of this in 2020 ? any word yet ? excited about the prospect of being able to include static assets like images in StackBlitz projects. |
I need to demo a web audio app and I need to fetch audio assets. I cannot do this cross domain due to CORS. I've created a github repo and dropped my assets to my Stackblitz, but it looks like they don't work, maybe served as document type or something like that. Any idea what I can do on my side? |
how how put images? Im a beginner i really dont have the idea. |
Hi @EricSimons, I also have this problem, cannot show the images from the assets folder. |
@philip-sultanescu currently we only support importing images as ESM import strings. Can you link your project here so I can take a look and send back a working example? |
@EricSimons Here you go, the github icon works when the project is compiled locally: Another bug is that if you download the whole StackBlitz project, then the assets/github_logo.png file is corrupted. However if you select only the png and click the Download "github_logo.png" button, then it gets shown in a new tab with this AWS presigned url, I expected it to download. I have solved this problem in my own https://FileMaps.io file manager website - where I use presigned URLs to show images and I also add 2 extra headers to force the download on most browsers (as opposed to opening in a new tab). This code is written in GO, but you can easily adapt it, as you can see I defined the attachment variable that I set to true whenever I want to download the image. If not then it will display. // presign returns signed S3 URL with expiration time.
func presign(svc *s3.S3, bucket, key string, expiration time.Duration, attachment bool) (string, error) {
input := s3.GetObjectInput{
Bucket: aws.String(bucket),
Key: aws.String(key),
}
if attachment {
input.ResponseContentDisposition = aws.String("attachment")
input.ResponseContentType = aws.String("application/octet-stream")
}
req, _ := svc.GetObjectRequest(&input)
// TODO: round the current time to the last half-hour and set the expiration to 1 hour,
// so that it can be cached by CloudFront
// https://advancedweb.hu/2018/11/15/s3_signed_urls_cloudfront/
return req.Presign(expiration)
} You will probably also need to add a CloudFront layer so your file urls have the same origin. I guess this is why they cannot be previewed in StackBlitz. If you want CloudFront to properly cache the images you will have to round the current time as I wrote in my TODO: comment. |
StackBlitz is now able to show images from the assets folder. Here is an example: |
Thank you all for your patience - We are launching new core technology into beta next month that should resolve this issue so this will be closed accordingly. If this issue persists, feel free to tag me or ask to reopen this issue with screenshots of the error. Thank you! :) |
It would be great, if a feature available to add image files such as (SVG, PNG, JPEG), currently it won't allow this type of files to add in the project directory.
The text was updated successfully, but these errors were encountered: