Image resize (client side) - web-services

I own web photo print service, main problem is that pictures users upload are twice in size (megabytes) than those I need to print them in standard photo size. Bandwidth and disk space is not a problem, what IS a problem is time it takes to upload them (for user).
If photo from camera is 2-3MB I wish to resize them somehow in half to about 1-1.5MB, that means it will upload 2x faster. Is this possible and with what technology? JAVA maybe? Thanks.

I'm pretty sure Flash allows for file access without requiring a "would you like to run this untrusted code" nagbox; IIRC Facebook has a Flash photo uploader. I think Java may also support this, but Flash is a bit more ubiquitous.

but only with flash player 10 or newer, it's possible to load user selected local data into flash before uploading it to the server. the image can then be manipulated client side.

Related

how to upload django files as background? Or how to increased file upload?

I need to increased file upload speed in Django. Any ways to do this? I guess about to upload files as a background, when user send POST request i just redirect them to some page and start uploading files. Any ways to do this? Or do you know any ways to increased upload speed? Thank you in advance
Low upload speed could be a result of several issues.
It is a normal situation and your client doesn't have a possibility to upload at a higher speed.
Your server instance using an old HDD and can't write quickly.
Your server works on another pool of requests and serves your clients as fast as it could but it is overloaded.
Your instance doesn't have free space on the hard drive
Your server redirects the file as a stream somewhere else.
You've written a not optimized code of the upload handler.
etc.
You don't use a proxy-server that works perfectly with slow clients and when a file is on the proxy server's side give it to Django in a moment.
You are trying to upload a very big file.
etc.
Maybe you have more details on how you handle the uploads and your environment.

How do websites set a maximum upload limit? Are there ways to bypass it?

For example: YouTube, before verifying your account, limits the maximum upload size to 15 minutes. How does it measure the size? Is there a way to edit the maximum upload size from your browser, make the site read the file as a 15-minute video though it's more, or is it all done on the server side, so there's no way to edit except from the server itself? This question also applies to other types of data, like text and images.
It's fixed server size, say in PHP. It takes the file, looks at it there, and rejects it based on what the file actually is. So no, it can't be bypassed.

On the fly Stream and transcode video with Django

I have a model that uses "models.FileField()", which I then display back to the user so they may click the link and have a file rendered in their browser. The user can upload various types of files.
Problem is, I'd like to handle large avi's differently, and have the file stream to the user.
The requirement I have is to simply stream/transcode video files from the media_root dir to an end user's browser, preferably in a mac friendly format. It would be for a couple users at most.
I've search and stumbled upon a few projects:
https://github.com/andrewebdev/django-video
https://github.com/rugginoso/django-transcodeandstream
As I am I a relatively newbie when it comes to django, I'm not sure how to incorporate their code into my proj.
Any thoughts, suggestions?
You can check Amazon Elastic Transcoder. It is a media transcoding in the cloud. It is designed to be a highly scalable, easy to use and a cost effective way for developers and businesses to convert (or “transcode”) media files from their source format into versions that will playback on devices like smartphones, tablets and PCs.
Or else you can check Webfaction, they have Video and image processing on their servers which you can use.
If you will use any of those, you can ask them about the installing process and how to integrate it in your project.
And one more thing, if you want to play the video on the browser, you will need a video player like jwplayer.
Hope this will help you get started! Best wishes!

How to load ~100 numpy arrays into django powered webpage

Well, these arrays are actually pixel data from DICOM images. When i just send them as an array (size 100) of pixel arrays (each about 1mb) it overloads the browser quite obviously. Being a newbie to programming, i would appreciate being pointed in the right direction to start working on economically loading large files , i.e., image-stacks into browser window , preferably dynamically. Apologies if the query is not clear
Hmmm... So your application is both at the same time? DICOM server and DICOM viewer?
The server is ment to respond to query-retrieve SOP classes and deliver images, the viewer will be the system sending those requests.
DICOM concepts would say your server should just be serving the images, the viewer is displaying them (including local file management, ...).
That would end up with a fat client (e.g. javascript if you want the viewer to be in a web browser), otherwise you won't be able to to interact with images at the speed you would like to (smooth scrolling, maybe 3D reconstruction, etc.).
If you just want to have some image pre-view capabilities on your server, I would suggest making a page with ~10-16 thumbnail images, one view for one or two full-size images, and load them per request if a user wants to preview image series or a single image. With that, you reduce load time significantly and your user is able to pre-select the images prior to sending a full request.
For the full viewer, I would consider a local solution on the client. If it should be web-based or not (or maybe mixed) depends on your further applications.
In past projects, we used existing open source DICOM servers like dcm4che for handlng the server part and just pulled our data from there. But for a teaching system, it might be interesting to build the server on your own as well to show all parts of the concept.
Feel free to comment, I'll try to update the post to answer questions.
I had exactly this same problem trying to develop a multiframe dicom viewer using just plain html5.
In order to be able to load such a big amount of imaging data in the browser, I decided to try using some web storage technology on the client side. In particular, I was considering to do some initial tests with indexedDB.
Sadly, I am currently involved in other tasks, so the web viewer development is now stopped (again!) and these tests are still undone.
Anyway, I would try to do a proof of concept with indexedDB.

How to stream video in a django app

I'm looking to stream video's as part of a django app, but I've never done anything with video and don't really know where to start. I don't have all the details of the project yet, but I'm expecting a fairly small library of videos uploaded by one or two people (Think less than 100 videos of about 5 mins length).
I'm looking for a solution that allows users to upload videos using django admin. I want to reach the majority of desktop browsers (95%+), and obviously I want to keep my costs down. Saying that I do like the idea of using some sort of cloud based CDN (I've no idea if that's possible / appropriate for this size of project)
I really want to ask if anyone can point me int he right direction (tutorials / services / projects / code), but I realise that might not be specific enough.
So to be more specific -
Is it possible to stream video to browsers using just django and an apache web server?
What cloud hosting providers will support easy integration with a django app?
Will I need to convert the format of my video's before they're ready to stream?
Can I use Red5 with a cloud hosting solution.
I want to host the project on a Ubuntu server that I use to host a
couple of other (low traffic) django apps - would it be a mistake to install Red5
on a server with existing sites.
From recollection, the server has 12GB RAM and 4 cores (in a 1and1
uk datacentre). Will I have enough power / bandwidth to stream say 3-5 video's simultaneously? (assuming red5 / wowza).
I'm not interested in Flash because I was rooting for Apple. Do I
need to need to re-evaluate my prejudices to be free of my ignorance?
I never streamed videos using Django/Python, but I have some experience in the field of streaming video in frontend apps. I can certainly not answer all your questions. In my experience it does not really matter where the video is hosted, a CDN is fine if you want to distribute the video world-wide.
I personally think you should start with the question on how you want to play the video in the browser. Choose an appropriate video player (could be html5 video) and you have an idea of what is possible to play and what not.
3) The format matters depending on how you want to stream the video. Progressive download (e.g. mp4)? Live streaming (unprogressive, e.g. HLS)? You can find example videos online and test if your video player can play the videos on the platform you want to support.
7) As said, you need to check out which player to use in this case. HTML5 video is not widely supported enough yet in my opinion, but can play most formats in the most modern browsers (Chrome, Safari).
Hope that helps.