View Single Post
ישן 20-12-05, 16:55   # 5
HaMashiah
חבר בקהילה
 
מיני פרופיל
תאריך הצטרפות: Oct 2005
מיקום: עכו סיטי!
גיל: 36
הודעות: 230
שלח הודעה באמצעות ICO אל HaMashiah

HaMashiah לא מחובר  

PHP קוד:
<?

$dir
="./images/";
$output="./simages/";
$width="80";
$height="80";
$src="0.jpg";
function 
randFname($ext){
    global 
$dir;

    
$fname=0;
    while(
file_exists($dir.$fname.".".$ext)){
        
$fname++;
    }
    return 
$dir.$fname.".".$ext;
}
foreach(
$HTTP_POST_FILES as $f){
    
$arr=explode(".",$f['name']);
    
$ext=$arr[count($arr)-1];
    
move_uploaded_file($f['tmp_name'], randFname($ext));
}

 function 
ImageResize($src,$width,$height,$output) { 

            
$info explode(".",$src); 
            
$ext strtolower($info[1]); 

            if(
$ext == "jpeg" || $ext == "jpg") { 
                
$source_image imagecreatefromjpeg($src); 
            } elseif(
$ext == "gif") { 
                
$source_image imagecreatefromgif($src); 
            } else { 
                die(
"Unknown image file type. (know only jpeg,jpg,gif) Filename supplied: $src"); 
            } 

            
$filesize = (list($awidth,$aheight) = getimagesize($src)); 

            
$output_image imagecreatetruecolor ($width$height); 

            
imagecopyresampled ($output_image$source_image0,0,0,0$width$height$awidth$aheight);  

            if(
$ext == "jpeg" || $ext == "jpg") { 
                
imagejpeg ($output_image,$output,100); 
            } else if (
$ext == "gif") { 
                
imagegif($output_image,$output,100); 
            } 

            
imagedestroy ($source_image);  
            
imagedestroy ($output_image);  
        }  

echo 
"התמונות הועלו בהצלחה!";
?>
תראה ניסיתי לשלב את זה בתוך זה פה...
(ה-0.jpg סתם לניסיון)
עכשיו יש לי כמה שאלות
1. למה הוא לא שמר לי את התמונה בתיקיה?
2. מה המשתנה של השם של הקובץ במערכת הזאת והסיומת?
תודה לעוזרים
  Reply With Quote