Проблем С Phpmelody

rutera24

Registered
Проблема е следният, че когато тръгвам да качвам аватари ми дава тази грешка:
Код:
Fatal error: Cannot redeclare resize_then_crop() in /home/rutera/public_html/video/include/functions.php on line 3008

структурата на functions.php
Код:
function resize_then_crop($filein, $fileout, $imagethumbsize_w, $imagethumbsize_h, $red, $green, $blue, $allowed_type = array())
{
        // $allowed_type = array('image/png', 'image/gif', 'image/jpg', 'image/jpeg', 'image/pjpeg');
        $percent = 0.5;
        // Get new dimensions
        $image_info     = getimagesize($filein);
        
        $width          = $image_info[0];
        $height         = $image_info[1];
        $new_width      = $width * $percent;
        $new_height     = $height * $percent;
        
        if(is_array($allowed_type) && count($allowed_type) > 0)
        {
                if(!in_array($image_info['mime'], $allowed_type))
                {
                        return false;
                }
        }
        
        if(preg_match("/.jpg/i", "$filein"))
        {
           $format = 'image/jpeg';
        }
        if (preg_match("/.gif/i", "$filein"))
        {
           $format = 'image/gif';
        }
        if(preg_match("/.png/i", "$filein"))
        {
           $format = 'image/png';
        }
        
        switch($format)
        {
            case 'image/jpeg':
                        $image = imagecreatefromjpeg($filein);
            break;
                
            case 'image/gif';
                $image = imagecreatefromgif($filein);
            break;
                
            case 'image/png':
                        $image = imagecreatefrompng($filein);
            break;
                
                default:
                        $image = '';
                break;
        }
        
        if (!$image)
        {
                return false;
        }
        
        $width  = $imagethumbsize_w;
        $height = $imagethumbsize_h;
        
        list($width_orig, $height_orig) = getimagesize($filein);
        
        if ($width_orig < $height_orig) 
        {
                $height = ($imagethumbsize_w / $width_orig) * $height_orig;
        } 
        else 
        {
                $width = ($imagethumbsize_h / $height_orig) * $width_orig;
        }
        
        if ($width < $imagethumbsize_w)
        {
                $width = $imagethumbsize_w;
                $height = ($imagethumbsize_w/ $width_orig) * $height_orig;;
        }
        
        if ($height < $imagethumbsize_h)
        {
                $height = $imagethumbsize_h;
                $width = ($imagethumbsize_h / $height_orig) * $width_orig;
        }
        
        $thumb          = imagecreatetruecolor($width , $height);
        $bgcolor        = imagecolorallocate($thumb, $red, $green, $blue);   
        ImageFilledRectangle($thumb, 0, 0, $width, $height, $bgcolor);
        imagealphablending($thumb, true);
        
        imagecopyresampled($thumb, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
        $thumb2 = imagecreatetruecolor($imagethumbsize_w , $imagethumbsize_h);
        
        // true color for best quality
        $bgcolor = imagecolorallocate($thumb2, $red, $green, $blue);   
        ImageFilledRectangle($thumb2, 0, 0,     $imagethumbsize_w , $imagethumbsize_h , $white);
        imagealphablending($thumb2, true);
        
        $w1 = ($width / 2) - ($imagethumbsize_w / 2);
        $h1 = ($height / 2) - ($imagethumbsize_h / 2);
        
        imagecopyresampled($thumb2, $thumb, 0,0, $w1, $h1, $imagethumbsize_w , $imagethumbsize_h ,$imagethumbsize_w, $imagethumbsize_h);
        
        if ($fileout != "")
        {
                imagegif($thumb2, $fileout); //write to file
        }
        
        return true;
}

?>

погледнете и споделете мнение че го мъча и не откривам нищо.
 
nedko каза:
Ако до сега са работили и изведнъж е станало така виж правата на папката където седят снимките дали е с пълни права.


правата са 777. И не принципно не ми работи.Според теб има ли някаде грешка или.!
 

Back
Горе