Home / Web Development / Ajax / Ajax Upload and Resize an Image with PHP

Ajax Upload and Resize an Image with PHP

Hi Guys,
Today I am presenting the most important social networking feature called ajax upload and resize an image without refreshing the page using PHP and jquery.

demo

This article contains three folders called js,includes and uploads with PHP files.

  • includes
    — getExtension.php
    — compressImage.php
  • js
    — jquery.min.js
    — jquery.form.js
  • uploads
    index.php
    ajaximageupload.php

We can upload the image through PHP page. And resize the uploaded image using Ajax in php page.

Javascript Code

index.php

Contains simple PHP and HTML code. Here $session_id=1 means user id session value.

ajaximage.php

Contains PHP code. This script helps you to upload images into uploads folder. Image file name rename into timestamp+session_id.extention

compressImage.php

Re-sizing image into different pixel dimensions.

getExtension.php

This extracts file extension.

download

If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

Leave a Reply

Your email address will not be published. Required fields are marked *

Social Media Auto Publish Powered By : XYZScripts.com