By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,156 Members | 1,071 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,156 IT Pros & Developers. It's quick & easy.

Image Resizing..Help!

P: 4
I have a page, where users can upload images, and it will be stored in MySQL as binary data(longblob). Now when i select this data from mysql to display in webpage, i want to resize the picture. Am using PHP/MySQL. Pls help me how to do this..!

Jun 18 '06 #1
Share this Question
Share on Google+
2 Replies

Expert 2.5K+
P: 4,258
I suggest that you first have a look at the standard PHP GD functions. See the PHP manual at

Ronald :cool:
Jul 31 '06 #2

P: 7
hope the following code works
// File and new size
$filename = 'test.jpg';
$percent = 0.5;

// Content type
header('Content-type: image/jpeg');

// Get new sizes
list($width, $height) = getimagesize($filename);
$newwidth = $width * $percent;
$newheight = $height * $percent;

// Load
$thumb = imagecreatetruecolor($newwidth, $newheight);
$source = imagecreatefromjpeg($filename);

// Resize
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);

// Output
taken from website
Jul 31 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.