Thumbs erstellen für alle Formate!

Dönerman

Gesperrt
Ich würde gerne einen script machen (finden) wo thumbs erstellt werden für alle format!

kennt ihr eine seite wo das schön beschreiben ist

mfg Dönerman
 
Das ist kein "ICH SUCHE FORUM"
wenn du suchst geh zu google oder von mir aus hotskripts oder so....
 
ich habe mir ein eigenes gebastelt, aber irgendwie erstellt er mir keins!

PHP:
 include ("dbconnect.php");
 
 $imgname = $_FILES['userfile']['name'];
 $path = 'upload';
 
 $kaa = substr($imgname, -4);
 
   $folder_scr  = "upload";
   $des_src	 = "thumbs";
   $thumbx	  = "70";
   $thumby	  = "70";
 
   function mkthumb($img_src,	
 				   $img_width,   
 				   $img_height, 
 				   $folder_scr,  
 				   $des_src)  
   {
 
 	if (($kaa == ".jpg") || ($kaa == "JPEG") || ($kaa == ".JPG") || ($kaa == "jpeg")){   
   
 	$image = imagecreatefromjpeg($folder_scr."/".$img_src);
 	list($src_width, $src_height) = getimagesize($folder_scr."/".$img_src);
 			if($src_width >= $src_height)
 			{
 			$new_image_width = $img_width;
 			$new_image_height = $src_height * $img_width / $src_width;
 			}
 				if($src_width < $src_height)
 				{
 				  $new_image_height = $img_width;
 			   	$new_image_width = $src_width * $img_height / $src_height;
 				}
 	$new_image = imagecreatetruecolor($new_image_width, $new_image_height);
 	imagecopyresampled($new_image, $image, 0, 0, 0, 0, $new_image_width,$new_image_height, $src_width, $src_height);
 	imagejpeg($new_image, $des_src."/".$img_src, 100);
 	}
 			if (($kaa == ".gif") || ($kaa == ".GIF")){   
   
 			   $image = imagecreatefromgif($folder_scr."/".$img_src);
 			   list($src_width, $src_height) = getimagesize($folder_scr."/".$img_src);
 			   		if($src_width >= $src_height)
 					   {
 			   		$new_image_width = $img_width;
 			  		$new_image_height = $src_height * $img_width / $src_width;
 					}
 		    			if($src_width < $src_height)
 						{
 			  		    $new_image_height = $img_width;
 			  		    $new_image_width = $src_width * $img_height / $src_height;
 						}
 			$new_image = imagecreatetruecolor($new_image_width, $new_image_height);
 		    imagecopyresampled($new_image, $image, 0, 0, 0, 0, $new_image_width,$new_image_height, $src_width, $src_height);
 			imagegif($new_image, $des_src."/".$img_src, 100);
 			  }			
 			
 		    		if (($kaa == ".png") || ($kaa == ".PNG")){   
   
 		    		$image = imagecreatefrompng($folder_scr."/".$img_src);
 		    		list($src_width, $src_height) = getimagesize($folder_scr."/".$img_src);
 		    		    	if($src_width >= $src_height)
 		    		    	{
 			  		    	$new_image_width = $img_width;
 			  		    	$new_image_height = $src_height * $img_width / $src_width;
 		    		    	}
 		    		    			if($src_width < $src_height)
 		    		    			{
 		    		    		    $new_image_height = $img_width;
 			  		    		    $new_image_width = $src_width * $img_height / $src_height;
 		    		    			}
 			 		$new_image = imagecreatetruecolor($new_image_width, $new_image_height);
 		    		imagecopyresampled($new_image, $image, 0, 0, 0, 0, $new_image_width,$new_image_height, $src_width, $src_height);
 		    		imagepng($new_image, $des_src."/".$img_src, 100);
 					}
   }// ende funktion
 
   $filename = $_SERVER['PHP_SELF'];
   $verz=opendir($folder_scr);
   $linkl = array ();
 	  while ($file = readdir ($verz))
 	  {
 		if($file != "." && $file != ".." && $file != $filename)
 		{
 		array_push ($linkl, "$file"); 
 		}
 	}
   
 		  $anzahl = count($linkl);
 		  sort ($linkl);
 		  foreach($linkl as $key => $value)
 		  {
 			if(!file_exists($des_src."/".$value))
 			{
 			  mkthumb($value, $thumbx, $thumby, $folder_scr, $des_src);
 			}
 		  }
 		  closedir($verz);
  
   $folder_scr  = "upload";
   $des_src	 = "view";
   $thumbx	  = "240";
   $thumby	  = "240";
 
   function kthumb($img_src,	
 				$img_width,   
 				$img_height, 
 				$folder_scr,  
 				$des_src)	 
   {
 	if (($kaa == ".jpg") || ($kaa == "JPEG") || ($kaa == ".JPG") || ($kaa == "jpeg")){   
   
 	$image = imagecreatefromjpeg($folder_scr."/".$img_src);
 	list($src_width, $src_height) = getimagesize($folder_scr."/".$img_src);
 		if($src_width >= $src_height)
 		{
 		$new_image_width = $img_width;
 		$new_image_height = $src_height * $img_width / $src_width;
 		}
 			   if($src_width < $src_height)
 			{
 			$new_image_height = $img_width;
 			$new_image_width = $src_width * $img_height / $src_height;
 			}
 	$new_image = imagecreatetruecolor($new_image_width, $new_image_height);
 	imagecopyresampled($new_image, $image, 0, 0, 0, 0, $new_image_width,$new_image_height, $src_width, $src_height);
 	   imagejpeg($new_image, $des_src."/".$img_src, 100);
 	  }
   
 		if (($kaa == ".gif") || ($kaa == ".GIF")){   
   
 		$image = imagecreatefromgif($folder_scr."/".$img_src);
 		list($src_width, $src_height) = getimagesize($folder_scr."/".$img_src);
 				if($src_width >= $src_height)
 				{
 				  $new_image_width = $img_width;
 			  	$new_image_height = $src_height * $img_width / $src_width;
 				}
 					if($src_width < $src_height)
 					{
 			  		$new_image_height = $img_width;
 			  		$new_image_width = $src_width * $img_height / $src_height;
 					}
 		$new_image = imagecreatetruecolor($new_image_width, $new_image_height);
 		imagecopyresampled($new_image, $image, 0, 0, 0, 0, $new_image_width,$new_image_height, $src_width, $src_height);
 		imagegif($new_image, $des_src."/".$img_src, 100);
 		  }		
 			if (($kaa == ".png") || ($kaa == ".PNG")){   
   
 			$image = imagecreatefrompng($folder_scr."/".$img_src);
 			list($src_width, $src_height) = getimagesize($folder_scr."/".$img_src);
 					if($src_width >= $src_height)
 					{
 			  		$new_image_width = $img_width;
 			  		$new_image_height = $src_height * $img_width / $src_width;
 					}
 		    			if($src_width < $src_height)
 						{
 			  		    $new_image_height = $img_width;
 			  		    $new_image_width = $src_width * $img_height / $src_height;
 						}
 			$new_image = imagecreatetruecolor($new_image_width, $new_image_height);
 		    imagecopyresampled($new_image, $image, 0, 0, 0, 0, $new_image_width,$new_image_height, $src_width, $src_height);
 			imagepng($new_image, $des_src."/".$img_src, 100);
 			  }
   }// ende funktion
 
 	$filename = $_SERVER['PHP_SELF'];
 	  $verz=opendir($folder_scr);
 	  $linkl = array ();
 	  while ($file = readdir ($verz))
 	  {
 			if($file != "." && $file != ".." && $file != $filename)
 			{
 			 array_push ($linkl, "$file"); 
 			}
 	  }
 	
 	  $anzahl = count($linkl);
 	  sort ($linkl);
 	  foreach($linkl as $key => $value)
 	  {
 			if(!file_exists($des_src."/".$value))
 			{
 			  kthumb($value, $thumbx, $thumby, $folder_scr, $des_src);
 			}
 	  }
 	
 	  closedir($verz);

ich weiß das ist viel code! ^^ bitte helft mir!

mfg Dönerman
 
Zurück