Ad block is installed and active. Please support us by disabling it.
HomeThursday, September 21, 2017, 03:18:54

Upload and Resize an Image with PHP

Monday, February 9, 15, 01:04:19, 3 Yaers Ago Via wain, Hits: 2635
Tutorial - How to upload and resize image with PHP

$extension = substr(strrchr($current_image, '.'), 1);
if (($extension!= "jpg") && ($extension != "jpeg"))
die('Unknown extension');
$time = date("fYhis");
$new_image = $time . "." . $extension;
$action = copy($_FILES['image']['tmp_name'], $destination);
if (!$action)
die('File copy failed');
echo "File copy successful";
$create = imagecreatefromjpeg($destination);
$currwidth = imagesx($create);
$currheight = imagesy($create);
$ccreate = ImageCreateTrueColor(50,50);
imagecopyresampled($ccreate, $create, 0, 0, 0, 0, 50, 50,
$currwidth, $currheight);
imagejpeg($ccreate, "thumbs/".$new_image);
<form method="post" enctype="multipart/form-data" action="upload.php">
<input type="file" name="image" ><br>
<input type="submit" name="Submit" value="submit">

Mister Sunday, May 22, 2011, 04:03:41

Great tutorials. Thanks for sharing, very useful for me..

Sign In



Link Base 1.1. - Free PHP Link Index Script

Manage your links using a MySQL database. Features easy install, user submission, and an admin panel to add, edit and remove categories and links.

Upload File with PHP

Basic file uploading with PHP

PHP filesize

The filesize function returns the size of the specified file.

PHP explode

Explode — Split a string by string.

PHP form with file upload

Advanced Contact Form with email and form field validation. It allows your visitors to send you an email directly from your website.

GuestBook PHP Script

Allow visitors to leave messages on your site. It features easy install, admin notification, and control panel to remove unwanted entries.

Creating a Math CAPTCHA with PHP - PHP Tutorial

This tutorial will show you how to create a form with Math Captcha.


Getimagesize function will determine the size of any given image file and return the dimensions along with the file type and a height/width text string to be used inside a normal HTML IMG tag and the correspondant HTTP content type.

Captcha V2 - Free PHP Script

PHP Captcha protection image Version 2, - Requirement(s): PHP Server, GD Library

PHP Forms

FREE PHP forms
About Author


Date Registered: Sun, Feb 8, 15
Last Time Online: Thu, Jun 15, 17
So far has created 115 entries.
This author has not yet filled in any details.