Tag: script

12 Jun

JavaScript image preview snippet

Code for custom JavaScript Image Upload Preview from a file input field.

JavaScript image preview

Time for another coding snippet – this time a JavaScript image preview. Several months ago, I was working on an trivia-like web-app. I needed to allow users to create their own trivia games and share them on social networks, and challenge their friends. Unlike many other trivia website, this one allows for games to actually look like games, meaning have an image representation of the game. This lead to creating an file input field, allowing game creators to actually upload their own image. Now, since the app is actually scaling and cropping the image, I had to come up with a way for game creator to see the image preview before the upload. Obviously, I needed my very own javascript image preview script, and here’s what I came up with.

Read more

Follow musingmick and share content:

Spread the word