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


image resize and upload

Reply
  #1 (permalink)  
Old 06-25-05, 07:37 PM
ascanio ascanio is offline
New Member
 
Join Date: Jun 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
image resize and upload

Ok here it is the upload function that i have on my website, I would like to integrate a resize function on the upload function
so what i want to do is replae this message ... can any body help me?

PHP Code:

$upfile_name[$x]." exceeds the maximum image size limit.<br> 

for a resize function
so if the image size is bigger than the maximage then the image is resize

PHP Code:

// UPLOAD FUNCTION

if ($email && $password && $upimages){
    
$validlogin verifylogin($email,$password);
    if (!
$validlogin){
        
$pagetitle $ihtitle.": Invalid Email and/or Password";
        if (
$headerfile) include $headerfile;
        print 
"The email or password you've entered is incorrect. Please go back and try again.";
        if (
$footerfile) include $footerfile;
        exit;
    }
    if (
count($upfile)==0$uploadstatus "You haven't selected any files to upload.<br>";

    if (!
$status && !$uploadstatus){
        for(
$x=0;$x<count($upfile);$x++){
            if (
$upfile_name[$x]){
                
$upfilestatus "";
                if ((
$maximgsize!="") && ($upfile_size[$x]>$maximgsize)) $upfilestatus $upfile_name[$x]." exceeds the maximum image size limit.<br>";
                if ((
$maximagesperaccount!="") && (numimagesacct($validlogin)>=$maximagesperaccount)) $upfilestatus $upfile_name[$x]." - You have uploaded the maximum number of images in your account.<br>";
                
$imgtyp substr($upfile_name[$x], -3);
                
$imgtyp strtolower($imgtyp);
                if ((
$imgtyp!="jpg") && ($imgtyp!="gif") && ($imgtyp!="png")) $upfilestatus $upfile_name[$x]." is not a valid image (JPG, GIF and PNG only).<br>";
                
$sql "select filename from $tablepics where owner='$validlogin' and filename='$upfile_name[$x]'";
                
$result mysql_query($sql) or die("Failed: $sql");
                
$numrows mysql_num_rows($result);
                if (
$numrows!=0$upfilestatus $upfile_name[$x]." - File already exists.<br>";
                if (!
$upfilestatus){
                    
$sql "insert into $tablepics values('', '$validlogin', '$upfile_name[$x]', '$upfile_size[$x]', '0', now())"
                    
$result mysql_query($sql) or die("Failed: $sql");
                    @
copy($upfile[$x], $upfilesfolder.$validlogin."-".$upfile_name[$x]);
                    
$uppedfiles $upfile_name[$x]." successfully uploaded.<br>";
                }
                
$uploadstatus .= $upfilestatus;
            }
        }
    }

thanks in advance
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
Stuck on imagejpeg whilst trying to upload BLOB to MySQL! zcosgrove PHP 5 06-30-10 12:03 PM
upload and watermark StickMan PHP 6 07-28-04 09:33 PM
will pay. php script needed. upload, resize, & email jamjammo Script Requests 4 02-29-04 09:30 PM
Help with image resize mdhall PHP 3 02-25-04 02:53 AM
Upload rename, resize & database insert therat PHP 3 01-16-04 03:42 PM


All times are GMT -5. The time now is 01:24 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.