0XHvn

display preview of an image without uploading to the server using javascript

All of us might be tried to load preview of an image which is to be uploaded to the server. Previously we can’t do this without uploading that particular file to the server. Now the latest versions of most of the browsers supports FILEREADER Web API. Using this we can display the preview of an image file without uploading to the server, using Javascript. The Javascript code given below:

 

Read More

Image caching using javascript

Here I’m going to say a simple way to cache images while loading web page using JavaScript. Well we know where the images are located in our server. So first we need to specify the path of images into an JavaScript array, which you want to cache while loading a web page as shown below:

 

Copy and paste the above code inside the head tag of your web page and call the function preCacheImages()  in onLoad event of body tag.

<body onload=”javascript: preCacheImages(arrImages);” >

 

Read More

Create an thumbnail image from a video file using php with ffmpeg library

For generating an image (thumbnail) from a video file using php with ffmpeg library, use the following code to achieve this.

 

Use php exec() function to do this. In the above code $target_path is the path where your video file located. $imgPath is the path where you want to store the image to be created. Size of the image to be generated, you can change by changing the value 200×200.

If you don’t know, how to install ffmpeg library in a LAMP environment see the post

Read More