Ad block is installed and active. Please support us by disabling it.
HomeSaturday, January 20, 2018, 16:47:08

Upload and Resize an Image with PHP

Monday, February 9, 15, 01:04:19, 3 Yaers Ago Via wain, Hits: 3363
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



Upload Image With PHP

[Example3] Tutorial - How to upload image in php.

PHP imagecreate

imagecreate() returns an image identifier representing a blank image of specified size.

PHP highlight_string - PHP Tutorial

Outputs or returns a syntax highlighted version of the given PHP code using the colors defined in the built-in syntax highlighter for PHP. Requirement(s): PHP Server.

Contact Us PHP Form 1.1.

A contact us form with email and form field validation. It allows your visitors to send you an email directly from your website.

PHP Str_replace - PHP Tutorial

This function returns a string or an array with all occurrences of search in subject replaced with the given replace value.

Syntax highlighting in Smarty

Syntax highlighting for Smarty - Google Code Prettify

PHP Jquery Form

PHP Jquery Form allow your visitors to contact you directly from your website.

PHP Mail

Sends an email.

Images In Textarea - CSS

Tutorial Images in Textarea

Preg_Match - PHP Email Validation

Validate email with preg_match in php
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.