Current location: Hot Scripts Forums » Programming Languages » PHP » image resize


image resize

Reply
  #1 (permalink)  
Old 07-11-05, 08:03 PM
ascanio ascanio is offline
New Member
 
Join Date: Jun 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
image resize

Hi everyone!! how can i resize the image uploaded if is bigger than the $maxsize?
thanks

PHP Code:

<?

include "./config.php";
if (
$file && $file_name){
    if (
$_FILES['file']['size']>$maxsize$status "Error: Picture size too large. Max file size is 100 kbytes. <a href='http://mydomain.com/thumbnail.php'>Image Resizer</a><br>";
    if ((
$_FILES['file']['type']!="image/gif") && ($_FILES['file']['type']!="image/jpeg") && ($_FILES['file']['type']!="image/jpg") && ($_FILES['file']['type']!="image/pjpeg")) $status .= "Error: Wrong file type. Must be JPG or GIF only.<br>";
    
$picext substr($file_name,-3);
    
$picext strtolower($picext);
    if ((!
$status) && ($picext!="gif") && ($picext!="jpg") && ($picext!="peg")) $status .= "Error: Wrong file type. Must be JPG or GIF only.<br>";

    if (!
$status){
        
$sql "insert into $table values('', '$email', '$aim', '$icq', '$yahoo', '$homepage', '0', '0', '1', '0', '0', '', now())";
        
$result mysql_query($sql) or die("Failed: $sql - ".mysql_error());
        
$sql "select max(id) from $table";
        
$result mysql_query($sql);
        
$resrow mysql_fetch_row($result);
        
$id $resrow[0];
        
$sql "update $table set picfile = '".$id.".".$picext."' where id='$id'";
        
$result mysql_query($sql);
        @
copy($file"./pics/".$id.".".$picext);
        
Header("Location: index.php?id=$id");
        exit;
    }
}
?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 07-12-05, 01:32 AM
Sabu Sabu is offline
Junior Code Guru
 
Join Date: Sep 2004
Posts: 458
Thanks: 0
Thanked 0 Times in 0 Posts
Look into imagecopyresized()
__________________
define('TRUE', FALSE);
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
image resize and upload ascanio PHP 0 06-25-05 07:37 PM
automatic image resize stscac PHP 2 02-26-05 07:11 PM
Please help -- need to resize Access OLE image jinlynn ASP 0 09-13-04 11:29 PM
how to draw an image inside a table? davidklonski HTML/XHTML/XML 2 07-06-04 11:27 AM
Help with image resize mdhall PHP 3 02-25-04 02:53 AM


All times are GMT -5. The time now is 09:43 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.