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
Hi,
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..!

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


ronverdonk
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 http://nl3.php.net/manual/en/ref.image.php

Ronald :cool:
Jul 31 '06 #2

P: 7
hi,
hope the following code works
<?php
// 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
imagejpeg($thumb);
?>
taken from php.net website
Jul 31 '06 #3

Post your reply

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