My team and I (all students, this is a college project) are creating a software, that's basically 2 frontends (a website and an app) connected to a backend through an API. We have the entity user in this software, and one of its properties its image since we expect to have a lot of users, We don't think storing the images directly on the database it's the best thing.
So in this kind of cases what should we do ? What's the best practice ? (all the components are going to be deployed so local storing it's not really an option).
(We had in mind to get some 3rd party service where we could upload the images and just store the link in the DB, but is this possible? is this fine?).
You can consider using cloud storage like
Amazon S3 (https://aws.amazon.com/s3/)
Google Cloud Bucket (https://cloud.google.com/storage/docs/creating-buckets)
Microsoft Azure Storage (https://learn.microsoft.com/en-us/azure/storage/common/storage-introduction)
They have some free of charge for experiments/learnings but you also need to be aware of charge fees after some certain usages limits. They're using cloud computing, so you don't need to worry about the performance.
Another choice that you can build your own image server and serve images directly to your website. The benefits could be
Having the same connection directly to your website via domains (faster than cloud sometimes)
You can flexibly control your image sizes/types according to your image requests. For example, you can convert your images to WebP or compress them to fit users' local devices
Of course, with this way, you need to have knowledge about building an image server.
there are many different cloud storage services that you can use to host images for your project. most popular of them is imgbb & imgur . I've been using them for a long time and they work great. Both have api's which are very simple to implement. If its your first time using them, you might want to watch a tutorial on youtube . Hopefully this helped you.
Related
I am a little confused as to how I should be handling image files in my project structure.
I have a workspace with a React app folder and a Web Api folder. The web api is for video games, and one of the fields in the model is a string, called image. I.e image: ‘call_of_duty_cover.jpg’
.
The thing is, we just learned how to upload images to web api, where we was taught to uplod into MyWebApi/wwwroot/images
But while doing some research I came across
a post here on Stack Overflow from 2017: Where should I store images in my web app?
Typically, you'll store images for your website in a directory called "imgs" underneath your root htdocs or public directory. This is considered the front end; you don't really store images in a backend or DB unless you're storing links to those images and providing those links via an API call.
If you wind up with lots of images, it's common to create more folders under that "imgs" directory, say one for each page or for one for each feature, but that's usually where images are kept.
So Im just confused as to why my lecturer would recommend using the wwwroot/images/ as source folder for imagefiles references with links in webapi?
And how would you guys recommend doing this? Thx
Edit: To clarify, the lecture I had the other day about image uploads was about how to upload images to webapi/wwwroot/images folder though React frontend— this is NOT what im asking today, I’m wondering in general where the image files that I reference in the webapi should be stored :) currently I have all the image files in the react project, under public/images/ :)
Edit 2:
So the project is to create a web api and database for different video games. And use react to make an interactive solution where one can play around with, I was thinking of doing a quiz thing. In the quiz, for every question I will need to fetch an image or an image link from the webapi to display the image. So I assume I store it somewhere in the folder structure and store strings of matching paths/filenames to fetch the images that way.
I will probably store 50+ games in the database :)
For static images that are part of the application you can have them in the React application in /public/images/.
For images uploaded by users you can store these images on the backend in /wwwroot/images/ on the backend API server.
You could also have the backend API upload images to a a dedicated content server or a content delivery network (CDN).
Is there any library in Xamarin which would store the pages that we browse in WKWebView?
Have to store the resources of the pages (CSS, fonts, js etc.) for offline viewing. The complexity is maintaining the folder structure and manage the resource Urls within the CSS and JS files. Any idea how the resources can be stored and loaded?
There are resources on how to save a html page and load the html in WKWebView.
Please note that this question is not about that. It is more about storing and managing the resources of the visited pages for offline viewing.
I don't think you're going to get your answer with a mobile only approach. It's not impossible to create one but I don't believe anything exists that will do what you want, happy to be proven wrong. I think you need to think outside the square a bit.
I can't give you the entire set of code because I don't own it (my company does) but I managed to take a website completely offline (with limitations of course) by using multiple resources to achieve the desired outcome.
I used a piece of software called Cyotek WebCopy in an Azure VM to scrape all of the website down to a folder. That folder was then zipped up and uploaded to Azure Blob Storage so it could be accessed from anywhere. The Xamarin app would then access the storage container, retrieve all of the blobs and then when a user clicks on a specific blob, it unzips down to the device and then opens up in a web view for the user to browse.
All of this was achieved using a web service and PowerShell scripts on the VM side and then of course your standard Xamarin based application for viewing.
Like I said, there are limitations to this but barring external links and database calls (like a submission page), it will work for you. It has worked for us.
It may sound like a lot of work but all in all, the VM side took me about 2 days and the Xamarin concept about 5 so all in all, not long to stand something up that is able to be built upon. I hope that helps.
I have an app that uses a sync function where all the content is saved locally from a server (CMS).
On the server I have text, images and videos. The script is downloading all that info and then is saving the text in text files and images and videos as bytes. In the editor and on android is working well and my question is how I can use an alternative to File.writeAllBytes for the web player. I searched a lot for solutions but I didn't find any. How I can access the file system on local storage from the web player or how can I use the cache system for this?
How I can access the file system on local storage from the web player
For security reasons, games run via the Unity Web Player are not given direct access to the file system. Unity's built-in PlayerPrefs system does allow you to store some data locally, but it only supports a few primitive types, and the Web Player limits the data to 1 MB.
It doesn't sound like you're using AssetBundles, but in case you are, the WWW class has a function LoadFromCacheOrDownload that can do some local caching. I'm not aware of any specific reason to limit that function to AssetBundles, but I would speculate that it was originally meant to push devs into buying the Pro license.
You can call JavaScript on the page that's hosting the game, with Application.ExternalCall and Application.ExternalEval, and the page itself can also send messages to the game by interacting with the web player object. I'm not a particularly savvy JS developer, but that may open up some other workarounds.
These limitations may impact your design options.
we have a video file which we have to "webcast" on the website (ASP.NET MVC 4 C#) to about 1000 users. I have absolutely no idea how to do this. I'm looking for answers to the following questions:
How webcasts are implemented in general? what are keywords I should be googling for?
How to synchronize video streams sent to different users?
How much computing power do I need for 1000 users? Need a rough answer of course. One server, or tens of servers.
any links, blog articles etc would be appreciated.
Thank you.
In general webcasts are implemented where there is a client software that sends tcp packets of stream data to server and server represents those packets as moving pictures.
In theory they already should be synchronized since you don't send the full video, you only send the current packets that are then buffered and represented as moving pictures. There will always be inconstancy in milliseconds because you cannot control every users ping to server.
It all depends on quality of your video as well as your webserver. No one will give you straight answer, you should always profile your applications on your own and see what bests fits your needs.
Since you are using C# MVC it is coupled with IIS, and IIS has something they call IIS Media Services that does exactly what you need. Definitely check it out.
Also you should check out c# live streadming in google, I found very interesting approach right here.
Well, as a streaming media person, here are my suggestions.
You could do a "live" webcast or an on-demand webcast depending on your choice. Live means, if you have a video file, you could broadcast it to multiple users at once and all will see it as if watching in a TV. They cannot pause your video. Normally, only live events are being broadcasted like this, unless you have a specific reason to broadcast an existing video file as a "fake" live broadcast.
You could use Windows Media Server (Add the media role in Windows Server 2003/2008/2012). Configuring and starting a windows media server needs intermediate level of familiarity with the streaming process, server, firewalls, exceptions. You have a lot of configurations which you can manage in this way, and generally suggested if you are very serious about your streaming. RTSP saves a lot of bandwidth for you too.
You could use Flash Media Server/Wowza media Server, Real Streaming Server also inplace of Windows media server.
For limited number of users, you can download the free Windows media Encoder, and select your file to be streamed, and click to stream easily. This is the easiest.
You could use managed streaming services from few thirdparties, like Livestream, Brightcove etc to stream video files.. Once you signup with them, the will give you an FTP/web space to upload your files, and they provide a link to the file (streaming media link). This link, you could embed in any popular player (like JWPlayer or any of that kind), and embed your player in your webpage for your users to start seeing the media. This is the most easy way to set it up. Maybe you can even get a 15 day trial services from brightcove or Mogolous.
Hope this answers your question.
I am creating application in which I would have database which users can´t edit. It just have data and it shows to user. I found that I dont have to use localstorage I just can add database to project and it is readonly. So I did it and everything is ok. Now I want to add images to my app and I am not sure what is better way. I can every image add to folder, in database store path to image and It´s very easy and It can do now. Or I found that I can store image in database as image (byte[]). What is better? Would be images in database smaller? Would be loading of images faster? If images in database is better solution have can I easy way add images to my existing database? Is there any article to do this in winforms? Thanks
Edit:
I'm glad that my question has so many answers and opinions. I want to explain more my needs. My application should have about 150 pictures and picture should be sized 150px and 100px. I want to app would work without internet connection. It could connect for updates but that´s all. Again thanks for all opinions :)
For our application, we found a hybrid approach worked best. We configured our SQL environment to support FILESTREAM and then imported all of our images. That gives us the flexibility of having the images 'in sql' while still storing the actual images to disk. Its a fast solution that may work well for you, too.
There are a lot of 'ifs', 'buts' and 'maybes' about where you put you put your images and I don't think there is a right or wrong way.
One thing worth mentioning is that if the application is business critical with high availability I would store them in the database, simply because the can be backed up with the rest of the data. Databases can be mirrored etc so having all the images treated as 'data' can be beneficial. Also if things get big and a web farm is employed and load balancers etc it helps when the images live in one place.
For me, I'd go with the database. But it all really depends on the scale of your application.
I personally would store all the images in isolated storage and in the database I would store the path to the image.
I would store all the images as a byte[] in the isolatedstorage
Nothing wrong with the answers already here but it really depends on what you are trying to accomplish and how it is currently set up.
Best would be to use a content delivery network for static images to ease the load of your web server.
You can serve from database or as resource file in file structure to your liking. If the images are static don't forget to add appropriate caching which for static content would be far future.
If you're rendering images I would definitely keep the images in the database to make it possible to access the images from any number of web servers.
If you want you can develop this further by keeping the images most recently used in memory or store on local filesystem so you don't have to get the file from the database every time.
web folder. also think about remote loading them from a cloud server like Amazon S3 to free up access to your own server
THe best option is to store your images on web folder, if you save them in DB, you will waste time retreiving them from DB because it takes more time