Jump to content

[SOLVED] Image Resize


ambo

Recommended Posts

Hey guys i have a script that uploads and displays pictures but i have stored them in a database now i was wondering if it is possible to resize the picture before it gets uploaded

UPLOADER CODE

if(isset($_POST['upload']) && $_FILES['userfile']['size'] > 0)

{

$fileName = $_FILES['userfile']['name'];

$tmpName  = $_FILES['userfile']['tmp_name'];

$fileSize = $_FILES['userfile']['size'];

$fileType = $_FILES['userfile']['type'];

 

$fp      = fopen($tmpName, 'r');

$content = fread($fp, filesize($tmpName));

$content = addslashes($content);

fclose($fp);

$user = $session->username;

if(!get_magic_quotes_gpc())

{

    $fileName = addslashes($fileName);

}

$SET = "UPDATE images SET id ='$user', name='$fileName', size='$fileSize', type='$fileType', content='$content'";

mysql_query($SET) or die('Error, query failed');

 

 

echo "<br>File $fileName uploaded<br>";

}

Link to comment
https://forums.phpfreaks.com/topic/140176-solved-image-resize/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.