Scale images before upload - asp.net

I have upload control on my asp.net (C#) page, I always upload pictures. Is there any way to scale images before I upload ?

You'll have to do something like flash on the client to do this, have a look here and here for examples.
It can't be done in JavaScript, etc...you'll need something with a bit more file system access, e.g. Flash, Silverlight, JavaApplet, etc. But seeing as there are premade flash solutions out there, that's the route I'd take.

A couple of solutions to your issue are below, since you haven't really specified how/where exactly you want to handle the image scaling.
http://upload.thinfile.com/image/
http://www.resize-before-upload.com/

Related

Upload Image to external image service

My meteor application need to be enriched with an image upload functionality. Since many free image upload services exist, I thought the best way of doing it would be by using an existing image upload service. My choice fell on imgur. I guess I somehow have to use imgur's image upload API, but this looks completely alien to me.
Here are my questions:
Is imgur appropriate for what I want? Do you know a better or simpler solution?
How do I upload an image to imgur from my meteor application?
You can assume that the image file comes from an html file input tag. Later on, when the mobile app catches up, the image should come from the camera, but let's just tackle one difficulty at a time.
FSCollection will be a great option here, you can use grids (to store images on the db) or use fs(to store in certain path)
For better explanation i made this tinny demo here is the DEMO and the code
Also i made this example using the progress bar, again here is the link to the DEMO and Source Code
A simpler solution would be to just store images in MongoDB or your filesystem using CollectionFS along with cfs:filesystem for your local file system or cfs:gridfs for MongoDB. The docs are clear and simple enough to get you up and running quickly.
If you wanted to use imgur, you'd need to be able to POST data and understand what you're doing. CollectionFS has a methods package which adds an HTTP POST method to Meteor, but honestly I think that'll just complicate things for you at this point. Keep it local for now.

Creating an image handler in Visual Basic for Ajax file upload

I'm not asking for detailed code for this question, but rather solid direction to learn how to do it myself. There appears to be many methods and directions so just looking for a headstart from someone experienced.
I have a simple file upload control. I want it to operate as an ajax upload, no page-refresh, and if I'm understanding correctly I need http handler that grabs the image and deals with it behind the scenes.
So I need to create a custom control, a new file upload that allows me to set some properties, such as... Path for the image, prefix for three different types (I.e. thm_uniqueimagename.jpg, med_uniqueimagename.jpg, lg_uniqueimagename.jpg) and an option to either KeepOriginal="True/False".
I'd like to see a progress bar while the image is uploading as well. A fantastic example would be a post on Facebook and how you can upload an image.
Right now I'm stuck with a standard upload control that has full post-back/refresh and it's just not nearly as attractive.
I'm just now learning VB... So basically if you can say... Read this tutorial, then do this, then do this... that would be greatly helpful. Just overwhelmed with what to do first, and how to put it all together.
Platform: Windows, .net, etc.
Thank you for any advice.
If you want a better user experience, then I suggest you investigate some solutions like the following:
ASP.NET AJAX file upload
AjaxFileUpload.
Note: If you read the documentation for the ASP.NET AJAX AjaxFileUploader, it says that it requires HTML5 for the progress feedback; otherwise it shows a spinner. So if progress feedback is a necessity and you cannot fully support HTML5 in your target browsers (i.e. older versions of IE; IE6, IE7, IE8, etc.), then you should look into the options below.
Custom HTTP module
NeatUpload is a free option.
Silverlight/Flash option
SWFUpload is a free option.
Asynchronous chunking option
RadAsyncUpload - Telerik's ASP.NET AsyncUpload is a pay option, check website for pricing.

Ajax File uploader

I just wanted to ask a question about uploading files via AJAX. I have researched on the web and found many articles on doing this. I am using ASP.NET 2.0.
I am probably going to go the jQuery route on this one, but I'm still unsure, I just need some feedback. Bacause my aim is to create an admin page for my client to add new products to his site when my client wishes to, so my client wants a simple file uploader and a multiple file uploader.
The first question is which is the best AJAX File Uploader to use?
The second question is how many files can you upload via AjAX, are there limits to how much you upload with different techniques ie. using jQuery or SWFUpload or using IHTTPHandler?
I would be grateful for your feedback.
Thanks.
I actually had to do this for an item here at work. To keep things rather simple, I went old-school and used a hidden iframe to do the file transfer in the background. There may be more fancy ways, but this worked for me. Also, there's no headaches when Adobe pushes out a bad update.
It was a while ago, so I can't remember the nuts n' bolts of the top of my head, but here's an article that seems to be using the same idea:
http://www.openjs.com/articles/ajax/ajax_file_upload/
This is a subjective question, as there is no one solution fits all for your application. The right answer is the uploader that meets your business needs. Limitations, if they exist, are set per whatever component you decide to use.

get thumbnail of divx/avi and mkv video (ASP.net)

When the user uploads a video (only divx/avi/mkv allowed) I'd like to get a thumbnail for the video so that is can be displayed in the divx player before play is clicked. Is there any way to do this is ASP.net or javascript.
The easiest way to do this would be to use something like FFMpeg, though it's a command line application and you'd probably need to write some kind of wrapper around it. For more information on the exact parameters you might need to use, check out Creating video thumbnails using ffmpeg.
There are some other options, such as Flash Video MX SDK, but they tend to be COM solutions rather than managed code and are generally quite clunky to implement. They can also be quite expensive, which may make them unfeasible.
You can use ffmpeg to create your thumbnails.
Checkout this blog post : link
In .net you can create Process and pass arguments to execute the tool from your code.

Localize Images in ASP.NET

A couple of years ago, we had a graphic designer revamp our website. His results looked great, but he unfortunately introduced a new unsupported font by the web browser.
At first I was like, "What!?!"... since most of our content is dynamic and there was no real way to pre-make all of the images. There was also the issue of multiple languages (since we knew Spanish was on the horizon).
Anyway, I decided to create some classes to auto-generate images via GDI+ and programatically cache them as needed. This solved most of our initial problems. However, now that our load has increased dramatically, there has been a drain on our UI server.
Now to the question... I am looking to replace most of the dynamic GDI+ images with a standard web browser font. I am thinking of keeping some of the rendered GDI+ images and putting them in a resx file, but plan to replace most of them with Tahoma or Arial fonts via asp:Labels.
Which have you found to be a better localized image solution?
Embedding images into the resx
Only adding the image url into the resx
Some other solution
My main concern is to limit the processing on the UI server. If that is the case, would adding the image url to the resx be a better solution compared to actually embedding the image into the resx?
You should only need to generate each image once, and then save it on the hard disk. The load on your site shouldn't increase the amount of processing you have to do. That being said, it almost sounds like you are using images for things you shouldn't be. If there are so many different images that you can't keep up with generating them, it's time to abandon your fancy images for things that shouldn't be images, and go back to straight text. If the user doesn't have the specified font installed, it should just fall back to a similar looking font. CSS has good support for this.
see my response here
This can be done manually or using some sort of automated (CMS) system.
The basic method is to cache your images in a language specific directory structure and then write an HTTP handler that effectively removes the additional directory layer. eg:
/images/
/en/
header1.gif
/es/
header1.gif
In your markup or CSS you would just reference /images/header1.gif. The http hander then uses session (if language is user specific), or config (if site specific) to choose which directory to serve the image from.
This provides a clean line bewteen code and content, and allows for client side caching. Resx is great for small strings but I much prefer a system like this for images and larger content. especially on the web where it is typically easy to switch images around.
I had the same problem a few years back and our interface team pointed us to SIFr. http://wiki.novemberborn.net/sifr/
You embed your font into a Flash movie and then use the SIFr JavaScript to dynamically convert your text into your font. Because it's client-side, there is no server-side impact.
If the user doesn't have Flash or JavaScript installed, they get the closest web-friendly font.
As an added bonus: because your content is still Text -- Google can search and index the content -- a huge SEO optimization.
Because of caching, I'd rather add only the image url into the resx. Caching is much better for static content (i-e plain files ) than for generated content.
I'd be very cautious about putting text in images at all, CSS with appropriate font-family fallback is probably the correct response on accessibility and good MVC grounds.
Where generation really is required I think Kiblee and JayArr outline good solutions

Resources