|  Beheerder |  | 
    
    
        
            
                
public function create_thumb($src, $dst, $width = 200, $height = 100, $streven = 'width', $kwaliteit = 75) {
		$src_img = @ImageCreateFromJPEG ( $src );
		
		$src_width = ImageSX ( $src_img );
		$src_height = ImageSY ( $src_img );
		
		//Kijken of het een portrait of een landscape of een vierkant is
		if ($src_height > $src_width) {
			/**
			 * Portrait
			 */
			$streven = 'width';
		} elseif ($src_height < $src_width) {
			/**
			 * Landscape
			 */
			$streven = 'width';
		} elseif ($src_height == $src_width) {
			$streven = 'both';
		}
		
		// Ratio's berekenen 
		if ($streven == 'width') {
			$ratio_x = ($src_width / $width);
			$ratio_y = $ratio_x;
		} elseif ($streven == 'height') {
			$ratio_y = ($src_height / $height);
			$ratio_x = $ratio_y;
		} elseif ($streven == 'both') {
			$ratio_x = ($src_width / $width);
			$ratio_y = ($src_height / $height);
		} else {
			return 'Incorrecte streefwaarde';
		}
		
		$dst_width = round ( $src_width / $ratio_x );
		$dst_height = round ( $src_height / $ratio_y );
		
		$dst_img = ImageCreateTrueColor ( $dst_width, $dst_height );
		$result = ImageCopyResampled ( $dst_img, $src_img, 0, 0, 0, 0, $dst_width, $dst_height, $src_width, $src_height );
		
		$result = ImageJPEG ( $dst_img, $dst, $kwaliteit );
		ImageDestroy ( $dst_img );
	}
 public function create_thumb($src, $dst, $width = 200, $height = 100, $streven = 'width', $kwaliteit = 75) {		$src_img = @ImageCreateFromJPEG ( $src ); 		$src_width = ImageSX ( $src_img );		$src_height = ImageSY ( $src_img ); 		//Kijken of het een portrait of een landscape of een vierkant is		if ($src_height > $src_width) {			/**			 * Portrait			 */			$streven = 'width';		} elseif ($src_height < $src_width) {			/**			 * Landscape			 */			$streven = 'width';		} elseif ($src_height == $src_width) {			$streven = 'both';		} 		// Ratio's berekenen 		if ($streven == 'width') {			$ratio_x = ($src_width / $width);			$ratio_y = $ratio_x;		} elseif ($streven == 'height') {			$ratio_y = ($src_height / $height);			$ratio_x = $ratio_y;		} elseif ($streven == 'both') {			$ratio_x = ($src_width / $width);			$ratio_y = ($src_height / $height);		} else {			return 'Incorrecte streefwaarde';		} 		$dst_width = round ( $src_width / $ratio_x );		$dst_height = round ( $src_height / $ratio_y ); 		$dst_img = ImageCreateTrueColor ( $dst_width, $dst_height );		$result = ImageCopyResampled ( $dst_img, $src_img, 0, 0, 0, 0, $dst_width, $dst_height, $src_width, $src_height ); 		$result = ImageJPEG ( $dst_img, $dst, $kwaliteit );		ImageDestroy ( $dst_img );	}
   
 Dit is een functie welke je door middel van een PHP.net: scandir per afbeelding kan aanroepen. Let er wel even op dat deze voor jpg bestanden is maar dit kan je makkelijk uitbreiden denk ik.
 |