Probleem met GD Library (Opgelost) 		
			
		
		 		
				
		
                        
                 
            
            
				
                
                    Jero3n                       
             
             
                        
                PHP interesse 
				
				ik heb deze code:
    
    
        
            
                
<?php
function newimg($id, $width, $height)
{
header("content-type: image/png"); 
$image[$id] = ImageCreate($width, $height); 
$achtergrond = ImageColorAllocate($image[$id], 255, 255, 255);
$black = ImageColorAllocate($image[$id], 0, 0, 0);
ImageLine($image[$id], 0, 0, $width, 0, $black); 
ImageLine($image[$id], 0, $height-1, $width, $height-1, $black);
ImageLine($image[$id], 0, 0, 0, $height-1, $black);
ImageLine($image[$id], $width-1, 0, $width-1, $height-1, $black);
}
function gaussian_blur($id, $times) {
$i="0";
While ($i<=$times) {
imagefilter($image[0], IMG_FILTER_GAUSSIAN_BLUR);
$i++;
}
function showimg($id) {
imagePNG($image[$id]);
}
newimg(0, 500, 500);
gaussian_blur(0, 5);
echo showimg(0);
?>
 
             
            <?php 
function  newimg( $id ,  $width ,  $height ) 
{ 
header ( "content-type: image/png" ) ;  $image [ $id ]  =  ImageCreate( $width ,  $height ) ;  
$achtergrond  =  ImageColorAllocate( $image [ $id ] ,  255 ,  255 ,  255 ) ; 
$black  =  ImageColorAllocate( $image [ $id ] ,  0 ,  0 ,  0 ) ; 
 
ImageLine( $image [ $id ] ,  0 ,  0 ,  $width ,  0 ,  $black ) ;  
ImageLine( $image [ $id ] ,  0 ,  $height - 1 ,  $width ,  $height - 1 ,  $black ) ; 
ImageLine( $image [ $id ] ,  0 ,  0 ,  0 ,  $height - 1 ,  $black ) ; 
ImageLine( $image [ $id ] ,  $width - 1 ,  0 ,  $width - 1 ,  $height - 1 ,  $black ) ; 
} 
 
function  gaussian_blur( $id ,  $times )  { 
 
$i = "0" ; 
 
While  ( $i <= $times )  { 
imagefilter( $image [ 0 ] ,  IMG_FILTER_GAUSSIAN_BLUR) ; 
$i ++; 
} 
 
function  showimg( $id )  { 
imagePNG( $image [ $id ] ) ; 
} 
 
newimg( 0 ,  500 ,  500 ) ; 
gaussian_blur( 0 ,  5 ) ; 
?> 
 
         
     
 Citaat: 
Parse error: syntax error, unexpected $end in C:Xamppxampphtdocsindex.php on line 31
 
              
        
		
				
		26 antwoorden 
                
                     
                
                    
		
		
	             
 
            
                    
                         
                    
                    
                        
                            Dark_Paul (laatste wijziging 08/04/2007 14:22)                             
                         
                     
                    
                        PHP ver gevorderde Goed kijken he...
    
    
        
            
                <?php
function newimg($id, $width, $height)
{
	header("content-type: image/png"); 
	$image[$id] = ImageCreate($width, $height); 
	$achtergrond = ImageColorAllocate($image[$id], 255, 255, 255);
	$black = ImageColorAllocate($image[$id], 0, 0, 0);
	
	ImageLine($image[$id], 0, 0, $width, 0, $black); 
	ImageLine($image[$id], 0, $height-1, $width, $height-1, $black);
	ImageLine($image[$id], 0, 0, 0, $height-1, $black);
	ImageLine($image[$id], $width-1, 0, $width-1, $height-1, $black);
}
function gaussian_blur($id, $times) {
	$i="0";
	
	While ($i<=$times) {
		imagefilter($image[0], IMG_FILTER_GAUSSIAN_BLUR);
		$i++;
	}
function showimg($id) {
	imagePNG($image[$id]);
}
newimg(0, 500, 500);
gaussian_blur(0, 5);
echo showimg(0);
?>
 
             
            <?php 
function  newimg( $id ,  $width ,  $height ) 
{ 
	header ( "content-type: image/png" ) ;   	$image [ $id ]  =  ImageCreate( $width ,  $height ) ;  
	$achtergrond  =  ImageColorAllocate( $image [ $id ] ,  255 ,  255 ,  255 ) ; 
	$black  =  ImageColorAllocate( $image [ $id ] ,  0 ,  0 ,  0 ) ; 
 
	ImageLine( $image [ $id ] ,  0 ,  0 ,  $width ,  0 ,  $black ) ;  
	ImageLine( $image [ $id ] ,  0 ,  $height - 1 ,  $width ,  $height - 1 ,  $black ) ; 
	ImageLine( $image [ $id ] ,  0 ,  0 ,  0 ,  $height - 1 ,  $black ) ; 
	ImageLine( $image [ $id ] ,  $width - 1 ,  0 ,  $width - 1 ,  $height - 1 ,  $black ) ; 
} 
 
function  gaussian_blur( $id ,  $times )  { 
 
	$i = "0" ; 
 
	While  ( $i <= $times )  { 
		imagefilter( $image [ 0 ] ,  IMG_FILTER_GAUSSIAN_BLUR) ; 
		$i ++; 
	} 
 
function  showimg( $id )  { 
	imagePNG( $image [ $id ] ) ; 
} 
 
newimg( 0 ,  500 ,  500 ) ; 
gaussian_blur( 0 ,  5 ) ; 
?> 
 
         
     
  
                      
                
                    
                         
                    
                    
                        
                            DenMette (laatste wijziging 08/04/2007 14:26)                             
                         
                     
                    
                        PHP gevorderde voor je wat tijd te besparen je bent ergens een } vergeten op lijn 23 
                      
                
                    
                         
                    
                    
                        
                            Jero3n                             
                         
                     
                    
                        PHP interesse dom van me, ik had de funtie gaussian_blur niet gesloten...
    
    
        
            
                <?php
function newimg($id, $width, $height)
{
  header("content-type: image/png"); 
  $image[$id] = ImageCreate($width, $height); 
  $achtergrond = ImageColorAllocate($image[$id], 255, 255, 255);
  $black = ImageColorAllocate($image[$id], 0, 0, 0);
  
  ImageLine($image[$id], 0, 0, $width, 0, $black); 
  ImageLine($image[$id], 0, $height-1, $width, $height-1, $black);
  ImageLine($image[$id], 0, 0, 0, $height-1, $black);
  ImageLine($image[$id], $width-1, 0, $width-1, $height-1, $black);
}
function gaussian_blur($id, $times) {
  $i=0;
  
  While ($i<=$times) {
    imagefilter($image[$id], IMG_FILTER_GAUSSIAN_BLUR);
    $i++;
  }
}
function showimg($id) {
  imagePNG($image[$id]);
}
newimg(0, 500, 500);
gaussian_blur(0, 5);
echo showimg(0);
?> 
             
            <?php 
function  newimg( $id ,  $width ,  $height ) 
{ 
  header ( "content-type: image/png" ) ;     $image [ $id ]  =  ImageCreate( $width ,  $height ) ;  
  $achtergrond  =  ImageColorAllocate( $image [ $id ] ,  255 ,  255 ,  255 ) ; 
  $black  =  ImageColorAllocate( $image [ $id ] ,  0 ,  0 ,  0 ) ; 
 
  ImageLine( $image [ $id ] ,  0 ,  0 ,  $width ,  0 ,  $black ) ;  
  ImageLine( $image [ $id ] ,  0 ,  $height - 1 ,  $width ,  $height - 1 ,  $black ) ; 
  ImageLine( $image [ $id ] ,  0 ,  0 ,  0 ,  $height - 1 ,  $black ) ; 
  ImageLine( $image [ $id ] ,  $width - 1 ,  0 ,  $width - 1 ,  $height - 1 ,  $black ) ; 
} 
 
function  gaussian_blur( $id ,  $times )  { 
 
  $i = 0 ; 
 
  While  ( $i <= $times )  { 
    imagefilter( $image [ $id ] ,  IMG_FILTER_GAUSSIAN_BLUR) ; 
    $i ++; 
  } 
} 
 
function  showimg( $id )  { 
  imagePNG( $image [ $id ] ) ; 
} 
 
newimg( 0 ,  500 ,  500 ) ; 
gaussian_blur( 0 ,  5 ) ; 
?> 
 
         
     
 Citaat: 
<br />
 
                      
                
                    
                         
                    
                    
                        
                            Jero3n (laatste wijziging 08/04/2007 14:37)                             
                         
                     
                    
                        PHP interesse Dat kan niet, want eerst had ik wat anders, ook met $image[$id] en toen werkte het wel...
    
    
        
            
                <?php
function newimg($id, $width, $height)
{
  header("content-type: image/png"); 
  $image[$id] = ImageCreate($width, $height); 
  $achtergrond = ImageColorAllocate($image[$id], 255, 255, 255);
  $black = ImageColorAllocate($image[$id], 0, 0, 0);
  
  ImageLine($image[$id], 0, 0, $width, 0, $black); 
  ImageLine($image[$id], 0, $height-1, $width, $height-1, $black);
  ImageLine($image[$id], 0, 0, 0, $height-1, $black);
  ImageLine($image[$id], $width-1, 0, $width-1, $height-1, $black);
  imagePNG($image[$id]);
  imagedestroy($image[$id]);
}
echo newimg(0, 500, 500);
?> 
             
            <?php 
function  newimg( $id ,  $width ,  $height ) 
{ 
  header ( "content-type: image/png" ) ;     $image [ $id ]  =  ImageCreate( $width ,  $height ) ;  
  $achtergrond  =  ImageColorAllocate( $image [ $id ] ,  255 ,  255 ,  255 ) ; 
  $black  =  ImageColorAllocate( $image [ $id ] ,  0 ,  0 ,  0 ) ; 
 
  ImageLine( $image [ $id ] ,  0 ,  0 ,  $width ,  0 ,  $black ) ;  
  ImageLine( $image [ $id ] ,  0 ,  $height - 1 ,  $width ,  $height - 1 ,  $black ) ; 
  ImageLine( $image [ $id ] ,  0 ,  0 ,  0 ,  $height - 1 ,  $black ) ; 
  ImageLine( $image [ $id ] ,  $width - 1 ,  0 ,  $width - 1 ,  $height - 1 ,  $black ) ; 
 
  imagePNG( $image [ $id ] ) ; 
  imagedestroy( $image [ $id ] ) ; 
} 
 
echo  newimg
( 0 ,  500 ,  500 ) ; ?> 
 
         
     
  
                      
                
                    
                         
                    
                    
                        
                            Dark_Paul                             
                         
                     
                    
                        PHP ver gevorderde Als je $image[$id] in de andere functies ook wilt gebruiken, moet je er een global van maken. 
                      
                
                    
                         
                    
                    
                        
                            Jero3n                             
                         
                     
                    
                        PHP interesse Sorry, ik werk nog niet zo lang met php, dus wat is een global?? 
                      
                
                    
                         
                    
                    
                        
                            mesynthetix (laatste wijziging 08/04/2007 14:52)                             
                         
                     
                    
                        Nieuw lid Gewoon de functie in dit veranderen:
    
    
        
            
                <?php // voor de kleurtjes
function gaussian_blur($id, $times) {
  // zorgt ervoor dat $image ook bruikbaar wordt in deze functie
  global $image;
  $i=0;
  
  While ($i<=$times) {
    imagefilter($image[$id], IMG_FILTER_GAUSSIAN_BLUR);
    $i++;
  }
} 
             
            <?php  // voor de kleurtjes 
function  gaussian_blur( $id ,  $times )  { 
  // zorgt ervoor dat $image ook bruikbaar wordt in deze functie 
 
  $i = 0 ; 
 
  While  ( $i <= $times )  { 
    imagefilter( $image [ $id ] ,  IMG_FILTER_GAUSSIAN_BLUR) ; 
    $i ++; 
  } 
} 
 
         
     
 
    
    
        
            
                <?php // voor de kleurtjes
function newimg($id, $width, $height)
{
  global $image;
  header("content-type: image/png"); 
  $image[$id] = ImageCreate($width, $height); 
  $achtergrond = ImageColorAllocate($image[$id], 255, 255, 255);
  $black = ImageColorAllocate($image[$id], 0, 0, 0);
  
  ImageLine($image[$id], 0, 0, $width, 0, $black); 
  ImageLine($image[$id], 0, $height-1, $width, $height-1, $black);
  ImageLine($image[$id], 0, 0, 0, $height-1, $black);
  ImageLine($image[$id], $width-1, 0, $width-1, $height-1, $black);
  imagePNG($image[$id]);
  imagedestroy($image[$id]);
}
echo newimg(0, 500, 500); 
             
            <?php  // voor de kleurtjes 
function  newimg( $id ,  $width ,  $height ) 
{ 
  header ( "content-type: image/png" ) ;     $image [ $id ]  =  ImageCreate( $width ,  $height ) ;  
  $achtergrond  =  ImageColorAllocate( $image [ $id ] ,  255 ,  255 ,  255 ) ; 
  $black  =  ImageColorAllocate( $image [ $id ] ,  0 ,  0 ,  0 ) ; 
 
  ImageLine( $image [ $id ] ,  0 ,  0 ,  $width ,  0 ,  $black ) ;  
  ImageLine( $image [ $id ] ,  0 ,  $height - 1 ,  $width ,  $height - 1 ,  $black ) ; 
  ImageLine( $image [ $id ] ,  0 ,  0 ,  0 ,  $height - 1 ,  $black ) ; 
  ImageLine( $image [ $id ] ,  $width - 1 ,  0 ,  $width - 1 ,  $height - 1 ,  $black ) ; 
 
  imagePNG( $image [ $id ] ) ; 
  imagedestroy( $image [ $id ] ) ; 
} 
 
echo  newimg
( 0 ,  500 ,  500 ) ;  
         
     
  
                      
                
                    
                         
                    
                    
                        
                            Jero3n (laatste wijziging 08/04/2007 15:54)                             
                         
                     
                    
                        PHP interesse oke, ik had wat doms gedaan, maarja, dat heb ik nu veranderd.
    
    
        
            
                
<?php
function newimg($id, $width, $height)
{
  header("content-type: image/png"); 
  $image[$id] = ImageCreate($width, $height); 
  $achtergrond = ImageColorAllocate($image[$id], 255, 255, 255);
  $black = ImageColorAllocate($image[$id], 0, 0, 0);
  
  ImageLine($image[$id], 0, 0, $width, 0, $black); 
  ImageLine($image[$id], 0, $height-1, $width, $height-1, $black);
  ImageLine($image[$id], 0, 0, 0, $height-1, $black);
  ImageLine($image[$id], $width-1, 0, $width-1, $height-1, $black);
  imagePNG($image[$id]);
}
function gaussian_blur($id, $times) {
  global $image;
  $i=0;
  
  While ($i<=$times) {
    imagefilter($image[$id], IMG_FILTER_GAUSSIAN_BLUR);
    $i++;
  }
}
function colorize($id, $red, $green, $blue) {
  global $image;
  imagefilter($image[$id], IMG_FILTER_COLORIZE, $red, $green, $blue);
}
function showimg($id) {
  imagePNG($image[$id]);
}
global $image;
newimg(0, 500, 500);
colorize(0, 0, 255, 0);
echo showimg(0);
imagedestroy($image[$id]);
?>
 
             
            <?php 
function  newimg( $id ,  $width ,  $height ) 
{ 
  header ( "content-type: image/png" ) ;     $image [ $id ]  =  ImageCreate( $width ,  $height ) ;  
  $achtergrond  =  ImageColorAllocate( $image [ $id ] ,  255 ,  255 ,  255 ) ; 
  $black  =  ImageColorAllocate( $image [ $id ] ,  0 ,  0 ,  0 ) ; 
 
  ImageLine( $image [ $id ] ,  0 ,  0 ,  $width ,  0 ,  $black ) ;  
  ImageLine( $image [ $id ] ,  0 ,  $height - 1 ,  $width ,  $height - 1 ,  $black ) ; 
  ImageLine( $image [ $id ] ,  0 ,  0 ,  0 ,  $height - 1 ,  $black ) ; 
  ImageLine( $image [ $id ] ,  $width - 1 ,  0 ,  $width - 1 ,  $height - 1 ,  $black ) ; 
 
  imagePNG( $image [ $id ] ) ; 
} 
 
 
function  gaussian_blur( $id ,  $times )  { 
 
  $i = 0 ; 
 
  While  ( $i <= $times )  { 
    imagefilter( $image [ $id ] ,  IMG_FILTER_GAUSSIAN_BLUR) ; 
    $i ++; 
  } 
} 
 
function  colorize( $id ,  $red ,  $green ,  $blue )  { 
 
  imagefilter( $image [ $id ] ,  IMG_FILTER_COLORIZE,  $red ,  $green ,  $blue ) ; 
} 
 
function  showimg( $id )  { 
  imagePNG( $image [ $id ] ) ; 
} 
 
 
newimg( 0 ,  500 ,  500 ) ; 
colorize( 0 ,  0 ,  255 ,  0 ) ; 
 
imagedestroy( $image [ $id ] ) ; 
?> 
 
         
     
   
                      
                
                    
                         
                    
                    
                        
                            Dark_Paul                             
                         
                     
                    
                        PHP ver gevorderde Dan moet je returnen ipv outputten in je functies. 
                      
                
                    
                         
                    
                    
                        
                            Jero3n (laatste wijziging 09/04/2007 09:58)                             
                         
                     
                    
                        PHP interesse moet ik dan doen:
    
    
        
            
                
<?php
function newimg($id, $width, $height)
{
  header("content-type: image/png"); 
  $image[$id] = ImageCreate($width, $height); 
  $achtergrond = ImageColorAllocate($image[$id], 255, 255, 255);
  $black = ImageColorAllocate($image[$id], 0, 0, 0);
  
  ImageLine($image[$id], 0, 0, $width, 0, $black); 
  ImageLine($image[$id], 0, $height-1, $width, $height-1, $black);
  ImageLine($image[$id], 0, 0, 0, $height-1, $black);
  ImageLine($image[$id], $width-1, 0, $width-1, $height-1, $black);
  ImagePNG($image[$id]);
}
function gaussian_blur($id, $times) {
  global $image;
  $i=0;
  
  While ($i<=$times) {
    imagefilter($image[$id], IMG_FILTER_GAUSSIAN_BLUR);
    $i++;
  return $image[$id];
  }
}
function colorize($id, $red, $green, $blue) {
  global $image;
  imagefilter($image[$id], IMG_FILTER_COLORIZE, $red, $green, $blue);
  return $image[$id];
}
global $image;
echo newimg(0, 500, 500);
echo colorize(0, 0, 255, 0);
imagedestroy($image[$id]);
?>
 
             
            <?php 
function  newimg( $id ,  $width ,  $height ) 
{ 
  header ( "content-type: image/png" ) ;     $image [ $id ]  =  ImageCreate( $width ,  $height ) ;  
  $achtergrond  =  ImageColorAllocate( $image [ $id ] ,  255 ,  255 ,  255 ) ; 
  $black  =  ImageColorAllocate( $image [ $id ] ,  0 ,  0 ,  0 ) ; 
 
  ImageLine( $image [ $id ] ,  0 ,  0 ,  $width ,  0 ,  $black ) ;  
  ImageLine( $image [ $id ] ,  0 ,  $height - 1 ,  $width ,  $height - 1 ,  $black ) ; 
  ImageLine( $image [ $id ] ,  0 ,  0 ,  0 ,  $height - 1 ,  $black ) ; 
  ImageLine( $image [ $id ] ,  $width - 1 ,  0 ,  $width - 1 ,  $height - 1 ,  $black ) ; 
 
  ImagePNG( $image [ $id ] ) ; 
} 
 
 
function  gaussian_blur( $id ,  $times )  { 
 
  $i = 0 ; 
 
  While  ( $i <= $times )  { 
    imagefilter( $image [ $id ] ,  IMG_FILTER_GAUSSIAN_BLUR) ; 
    $i ++; 
 
  return  $image [ $id ] ; 
  } 
} 
 
function  colorize( $id ,  $red ,  $green ,  $blue )  { 
 
  imagefilter( $image [ $id ] ,  IMG_FILTER_COLORIZE,  $red ,  $green ,  $blue ) ; 
 
  return  $image [ $id ] ; 
} 
 
 
echo  newimg
( 0 ,  500 ,  500 ) ; echo  colorize
( 0 ,  0 ,  255 ,  0 ) ;  
imagedestroy( $image [ $id ] ) ; 
?> 
 
         
     
  
                      
                
                    
                         
                    
                    
                        
                            Dark_Paul                             
                         
                     
                    
                        PHP ver gevorderde Ik ben niet zo handig met GD, maar misschien werkt dit:
    
    
        
            
                <?php
function newimg($id, $width, $height)
{
  header("content-type: image/png"); 
  $image[$id] = ImageCreate($width, $height); 
  $achtergrond = ImageColorAllocate($image[$id], 255, 255, 255);
  $black = ImageColorAllocate($image[$id], 0, 0, 0);
  
  ImageLine($image[$id], 0, 0, $width, 0, $black); 
  ImageLine($image[$id], 0, $height-1, $width, $height-1, $black);
  ImageLine($image[$id], 0, 0, 0, $height-1, $black);
  ImageLine($image[$id], $width-1, 0, $width-1, $height-1, $black);
  return $image[$id];
}
function gaussian_blur($id, $times) {
  global $image;
  $i=0;
  
  While ($i<=$times) {
    imagefilter($image[$id], IMG_FILTER_GAUSSIAN_BLUR);
    $i++;
  return $image[$id];
  }
}
function colorize($id, $red, $green, $blue) {
  global $image;
  imagefilter($image[$id], IMG_FILTER_COLORIZE, $red, $green, $blue);
  return $image[$id];
}
function create($img) {
	ImagePNG($img);
	imagedestroy($img);
}
$img = newimg(0, 500, 500);
$img = colorize(0, 0, 255, 0);
echo $image[$id];
?> 
             
            <?php 
function  newimg( $id ,  $width ,  $height ) 
{ 
  header ( "content-type: image/png" ) ;     $image [ $id ]  =  ImageCreate( $width ,  $height ) ;  
  $achtergrond  =  ImageColorAllocate( $image [ $id ] ,  255 ,  255 ,  255 ) ; 
  $black  =  ImageColorAllocate( $image [ $id ] ,  0 ,  0 ,  0 ) ; 
 
  ImageLine( $image [ $id ] ,  0 ,  0 ,  $width ,  0 ,  $black ) ;  
  ImageLine( $image [ $id ] ,  0 ,  $height - 1 ,  $width ,  $height - 1 ,  $black ) ; 
  ImageLine( $image [ $id ] ,  0 ,  0 ,  0 ,  $height - 1 ,  $black ) ; 
  ImageLine( $image [ $id ] ,  $width - 1 ,  0 ,  $width - 1 ,  $height - 1 ,  $black ) ; 
 
  return  $image [ $id ] ; 
} 
 
 
function  gaussian_blur( $id ,  $times )  { 
 
  $i = 0 ; 
 
  While  ( $i <= $times )  { 
    imagefilter( $image [ $id ] ,  IMG_FILTER_GAUSSIAN_BLUR) ; 
    $i ++; 
 
  return  $image [ $id ] ; 
  } 
} 
 
function  colorize( $id ,  $red ,  $green ,  $blue )  { 
 
  imagefilter( $image [ $id ] ,  IMG_FILTER_COLORIZE,  $red ,  $green ,  $blue ) ; 
 
  return  $image [ $id ] ; 
} 
 
function  create( $img )  { 
	ImagePNG( $img ) ; 
	imagedestroy( $img ) ; 
} 
 
 
$img  =  newimg( 0 ,  500 ,  500 ) ; 
$img  =  colorize( 0 ,  0 ,  255 ,  0 ) ; 
 
?> 
 
         
     
  
                      
                
                    
                         
                    
                    
                        
                            Jero3n                             
                         
                     
                    
                        PHP interesse ten eerste:Citaat: 
<br />
 
                      
                
                    
                         
                    
                    
                        
                            Dark_Paul                             
                         
                     
                    
                        PHP ver gevorderde Owjah, create ben ik vergeten ><. Maar dat kan je zelf ook nog wel aanroepen, piece of cake. 
                      
                
                    
                         
                    
                    
                        
                            Jero3n (laatste wijziging 09/04/2007 14:07)                             
                         
                     
                    
                        PHP interesse ik heb het nu iets veranderd, nl. dat er een knop komt dat als je er op klikt dat hij de colorize uitvoert.
    
    
        
            
                
<?php
function newimg($id, $width, $height)
{
  header("content-type: image/png"); 
  $image[$id] = ImageCreate($width, $height); 
  $achtergrond = ImageColorAllocate($image[$id], 255, 255, 255);
  $black = ImageColorAllocate($image[$id], 0, 0, 0);
  
  ImageLine($image[$id], 0, 0, $width, 0, $black); 
  ImageLine($image[$id], 0, $height-1, $width, $height-1, $black);
  ImageLine($image[$id], 0, 0, 0, $height-1, $black);
  ImageLine($image[$id], $width-1, 0, $width-1, $height-1, $black);
  ImagePNG($image[$id]);
  imagedestroy($image[$id]);
  return $image[$id];
}
function gaussian_blur($id, $times) {
  global $image;
  $i=0;
  
  While ($i<=$times) {
    imagefilter($image[$id], IMG_FILTER_GAUSSIAN_BLUR);
    $i++;
  return $image[$id];
  }
}
function colorize($id, $red, $green, $blue) {
  global $image;
  imagefilter($image[$id], IMG_FILTER_COLORIZE, $red, $green, $blue);
  return $image[$id];
}
function create() {
  ImagePNG($img);
  imagedestroy($img);
}
global $image;
$img = newimg(0, 500, 500);
$make = create();
echo $image[$id];
?>
<html>
<head>
<title>Test!</title>
</head>
<body>
<form name="form" method="post" action="">
<input type="button" name="colorize_knop" value="Colorize" onclick="<? $img = colorize(0, 0, 255, 0); ?>">
</form>
</body></html>
 
             
            <?php 
function  newimg( $id ,  $width ,  $height ) 
{ 
  header ( "content-type: image/png" ) ;     $image [ $id ]  =  ImageCreate( $width ,  $height ) ;  
  $achtergrond  =  ImageColorAllocate( $image [ $id ] ,  255 ,  255 ,  255 ) ; 
  $black  =  ImageColorAllocate( $image [ $id ] ,  0 ,  0 ,  0 ) ; 
 
  ImageLine( $image [ $id ] ,  0 ,  0 ,  $width ,  0 ,  $black ) ;  
  ImageLine( $image [ $id ] ,  0 ,  $height - 1 ,  $width ,  $height - 1 ,  $black ) ; 
  ImageLine( $image [ $id ] ,  0 ,  0 ,  0 ,  $height - 1 ,  $black ) ; 
  ImageLine( $image [ $id ] ,  $width - 1 ,  0 ,  $width - 1 ,  $height - 1 ,  $black ) ; 
 
  ImagePNG( $image [ $id ] ) ; 
  imagedestroy( $image [ $id ] ) ; 
 
  return  $image [ $id ] ; 
} 
 
 
function  gaussian_blur( $id ,  $times )  { 
 
  $i = 0 ; 
 
  While  ( $i <= $times )  { 
    imagefilter( $image [ $id ] ,  IMG_FILTER_GAUSSIAN_BLUR) ; 
    $i ++; 
 
  return  $image [ $id ] ; 
  } 
} 
 
function  colorize( $id ,  $red ,  $green ,  $blue )  { 
 
  imagefilter( $image [ $id ] ,  IMG_FILTER_COLORIZE,  $red ,  $green ,  $blue ) ; 
 
  return  $image [ $id ] ; 
} 
 
function  create( )  { 
  ImagePNG( $img ) ; 
  imagedestroy( $img ) ; 
} 
 
 
$img  =  newimg( 0 ,  500 ,  500 ) ; 
 
$make  =  create( ) ; 
 
?> 
 
<html>
<head>
<title>Test!</title>
</head>
<body>
<form name="form" method="post" action="">
<input type="button" name="colorize_knop" value="Colorize" onclick="<?  $img  =  colorize( 0 ,  0 ,  255 ,  0 ) ;  ?> ">
</form>
</body></html>
 
         
     
   
                      
                
                    
                         
                    
                    
                        
                            Dark_Paul (laatste wijziging 09/04/2007 14:17)                             
                         
                     
                    
                        PHP ver gevorderde Hoe vaak moet dit nog gezegd worden?! 
                      
                
                    
                         
                    
                    
                        
                            Jero3n (laatste wijziging 09/04/2007 14:31)                             
                         
                     
                    
                        PHP interesse maar hoe kan ik dan toch zorgen dat als ik op de knop druk hij dat doet?
    
    
        
            
                
<?php
function newimg($id, $width, $height)
{
  header("content-type: image/png"); 
  $image[$id] = ImageCreate($width, $height); 
  $achtergrond = ImageColorAllocate($image[$id], 255, 255, 255);
  $black = ImageColorAllocate($image[$id], 0, 0, 0);
  
  ImageLine($image[$id], 0, 0, $width, 0, $black); 
  ImageLine($image[$id], 0, $height-1, $width, $height-1, $black);
  ImageLine($image[$id], 0, 0, 0, $height-1, $black);
  ImageLine($image[$id], $width-1, 0, $width-1, $height-1, $black);
  ImagePNG($image[$id]);
  return $image[$id];
}
function gaussian_blur($id, $times) {
  global $image;
  $i=0;
  
  While ($i<=$times) {
    imagefilter($image[$id], IMG_FILTER_GAUSSIAN_BLUR);
    $i++;
  return $image[$id];
  }
}
function colorize($id, $red, $green, $blue) {
  global $image;
  imagefilter($image[$id], IMG_FILTER_COLORIZE, $red, $green, $blue);
  return $image[$id];
}
function create($img) {
  ImagePNG($img);
  imagedestroy($img);
}
global $image;
$img = newimg(0, 500, 500);
$img = colorize(0, 0, 255, 0);
echo create($img);
?>
 
             
            <?php 
function  newimg( $id ,  $width ,  $height ) 
{ 
  header ( "content-type: image/png" ) ;     $image [ $id ]  =  ImageCreate( $width ,  $height ) ;  
  $achtergrond  =  ImageColorAllocate( $image [ $id ] ,  255 ,  255 ,  255 ) ; 
  $black  =  ImageColorAllocate( $image [ $id ] ,  0 ,  0 ,  0 ) ; 
 
  ImageLine( $image [ $id ] ,  0 ,  0 ,  $width ,  0 ,  $black ) ;  
  ImageLine( $image [ $id ] ,  0 ,  $height - 1 ,  $width ,  $height - 1 ,  $black ) ; 
  ImageLine( $image [ $id ] ,  0 ,  0 ,  0 ,  $height - 1 ,  $black ) ; 
  ImageLine( $image [ $id ] ,  $width - 1 ,  0 ,  $width - 1 ,  $height - 1 ,  $black ) ; 
 
  ImagePNG( $image [ $id ] ) ; 
 
  return  $image [ $id ] ; 
} 
 
 
function  gaussian_blur( $id ,  $times )  { 
 
  $i = 0 ; 
 
  While  ( $i <= $times )  { 
    imagefilter( $image [ $id ] ,  IMG_FILTER_GAUSSIAN_BLUR) ; 
    $i ++; 
 
  return  $image [ $id ] ; 
  } 
} 
 
function  colorize( $id ,  $red ,  $green ,  $blue )  { 
 
  imagefilter( $image [ $id ] ,  IMG_FILTER_COLORIZE,  $red ,  $green ,  $blue ) ; 
 
  return  $image [ $id ] ; 
} 
 
function  create( $img )  { 
  ImagePNG( $img ) ; 
  imagedestroy( $img ) ; 
} 
 
 
$img  =  newimg( 0 ,  500 ,  500 ) ; 
$img  =  colorize( 0 ,  0 ,  255 ,  0 ) ; 
 
?> 
 
         
     
 Citaat: 
<br />
 
                      
                
                    
                         
                    
                    
                        
                            Dark_Paul (laatste wijziging 09/04/2007 14:37)                             
                         
                     
                    
                        PHP ver gevorderde Je moet in newimg() ook geen ImagePNG doen, dan wordt de afbeelding 'gedrukt' om het zo maar te noemen. 
                      
                
                    
                         
                    
                    
                        
                            Jero3n                             
                         
                     
                    
                        PHP interesse dat is het probleem juist. 
                      
                
                    
                         
                    
                    
                        
                            Dark_Paul (laatste wijziging 09/04/2007 15:04)                             
                         
                     
                    
                        PHP ver gevorderde Volgens mij zat je onnodig moeilijk te doen met die globals en arrays.
    
    
        
            
                <?php
header("content-type: image/png"); 
function newimg($width, $height) {
  $image = ImageCreate($width, $height); 
  $achtergrond = ImageColorAllocate($image, 255, 255, 255);
  $black = ImageColorAllocate($image, 0, 0, 0);
  
  ImageLine($image, 0, 0, $width, 0, $black); 
  ImageLine($image, 0, $height-1, $width, $height-1, $black);
  ImageLine($image, 0, 0, 0, $height-1, $black);
  ImageLine($image, $width-1, 0, $width-1, $height-1, $black);
  return $image;
}
function gaussian_blur($img, $times) {
  $i=0;
  for ($i=0; $i < $times; $i++){
    $image = imagefilter($img, IMG_FILTER_GAUSSIAN_BLUR);
  }
  return $image
}
function colorize($img, $red, $green, $blue) {
  $image = imagefilter($img, IMG_FILTER_COLORIZE, $red, $green, $blue);
  return $image;
}
function create($img) {
  ImagePNG($img);
  imagedestroy($img);
}
$img = newimg(0, 500, 500);
$img = colorize($img, 0, 255, 0);
echo create($img);
?> 
             
            <?php 
header ( "content-type: image/png" ) ;   
function  newimg( $width ,  $height )  { 
  $image  =  ImageCreate( $width ,  $height ) ;  
  $achtergrond  =  ImageColorAllocate( $image ,  255 ,  255 ,  255 ) ; 
  $black  =  ImageColorAllocate( $image ,  0 ,  0 ,  0 ) ; 
 
  ImageLine( $image ,  0 ,  0 ,  $width ,  0 ,  $black ) ;  
  ImageLine( $image ,  0 ,  $height - 1 ,  $width ,  $height - 1 ,  $black ) ; 
  ImageLine( $image ,  0 ,  0 ,  0 ,  $height - 1 ,  $black ) ; 
  ImageLine( $image ,  $width - 1 ,  0 ,  $width - 1 ,  $height - 1 ,  $black ) ; 
 
  return  $image ; 
} 
 
function  gaussian_blur( $img ,  $times )  { 
  $i = 0 ; 
  for  ( $i = 0 ;  $i  <  $times ;  $i ++ ) { 
    $image  =  imagefilter( $img ,  IMG_FILTER_GAUSSIAN_BLUR) ; 
  } 
  return  $image 
} 
 
function  colorize( $img ,  $red ,  $green ,  $blue )  { 
  $image  =  imagefilter( $img ,  IMG_FILTER_COLORIZE,  $red ,  $green ,  $blue ) ; 
  return  $image ; 
} 
 
function  create( $img )  { 
  ImagePNG( $img ) ; 
  imagedestroy( $img ) ; 
} 
 
$img  =  newimg( 0 ,  500 ,  500 ) ; 
$img  =  colorize( $img ,  0 ,  255 ,  0 ) ; 
 
?> 
 
         
     
  
                      
                
                    
                         
                    
                    
                        
                            Jero3n (laatste wijziging 09/04/2007 16:35)                             
                         
                     
                    
                        PHP interesse Citaat: 
Parse error: syntax error, unexpected '}' in C:Xamppxampphtdocsindex.php on line 23
  
                
                    
                         
                    
                    
                        
                            Dark_Paul (laatste wijziging 09/04/2007 17:21)                             
                         
                     
                    
                        PHP ver gevorderde Een parse-error, goed kijken dus.. Wat zegt de error?;  ben vergeten. Dit is standaard debuggen en moet je zelf dus ook kunnen als je wilt gaan PHP'en. 
                      
                
                    
                         
                    
                    
                        
                            JBke                             
                         
                     
                    
                        PHP gevorderde wil niet zeggen dat de fout zich op regel 31 bevind maar als je bvb een ; vergeten bent kan het zijn dat het zich pas resulteert in regel 31. 
                      
                
                    
                         
                    
                    
                        
                            Jero3n (laatste wijziging 10/04/2007 07:20)                             
                         
                     
                    
                        PHP interesse k, dan wordt het dit
    
    
        
            
                <?php
header("content-type: image/png"); 
function newimg($id, $width, $height) {
  $image = ImageCreate($width, $height); 
  $achtergrond = ImageColorAllocate($image, 255, 255, 255);
  $black = ImageColorAllocate($image, 0, 0, 0);
  
  ImageLine($image, 0, 0, $width, 0, $black); 
  ImageLine($image, 0, $height-1, $width, $height-1, $black);
  ImageLine($image, 0, 0, 0, $height-1, $black);
  ImageLine($image, $width-1, 0, $width-1, $height-1, $black);
  return $image;
}
function gaussian_blur($img, $times) {
  $i=0;
  for ($i=0; $i < $times; $i++){
    $image = imagefilter($img, IMG_FILTER_GAUSSIAN_BLUR);
  }
  return $image;
}
function colorize($img, $red, $green, $blue) {
  $image = imagefilter($img, IMG_FILTER_COLORIZE, $red, $green, $blue);
  return $image;
}
function create($img) {
  ImagePNG($img);
  imagedestroy($img);
}
$img = newimg(0, 500, 500);
$img = colorize($img, 0, 255, 0);
echo create($img);
?> 
             
            <?php 
header ( "content-type: image/png" ) ;   
function  newimg( $id ,  $width ,  $height )  { 
  $image  =  ImageCreate( $width ,  $height ) ;  
  $achtergrond  =  ImageColorAllocate( $image ,  255 ,  255 ,  255 ) ; 
  $black  =  ImageColorAllocate( $image ,  0 ,  0 ,  0 ) ; 
 
  ImageLine( $image ,  0 ,  0 ,  $width ,  0 ,  $black ) ;  
  ImageLine( $image ,  0 ,  $height - 1 ,  $width ,  $height - 1 ,  $black ) ; 
  ImageLine( $image ,  0 ,  0 ,  0 ,  $height - 1 ,  $black ) ; 
  ImageLine( $image ,  $width - 1 ,  0 ,  $width - 1 ,  $height - 1 ,  $black ) ; 
 
  return  $image ; 
} 
 
function  gaussian_blur( $img ,  $times )  { 
  $i = 0 ; 
  for  ( $i = 0 ;  $i  <  $times ;  $i ++ ) { 
    $image  =  imagefilter( $img ,  IMG_FILTER_GAUSSIAN_BLUR) ; 
  } 
  return  $image ; 
} 
 
function  colorize( $img ,  $red ,  $green ,  $blue )  { 
  $image  =  imagefilter( $img ,  IMG_FILTER_COLORIZE,  $red ,  $green ,  $blue ) ; 
  return  $image ; 
} 
 
function  create( $img )  { 
  ImagePNG( $img ) ; 
  imagedestroy( $img ) ; 
} 
 
$img  =  newimg( 0 ,  500 ,  500 ) ; 
$img  =  colorize( $img ,  0 ,  255 ,  0 ) ; 
 
?> 
 
         
     
 Citaat: 
<br />
 
                      
                
                    
                         
                    
                    
                        
                            CDNC (laatste wijziging 10/04/2007 09:32)                             
                         
                     
                    
                        PHP ver gevorderde Kom je nou voor elke fout hier de oplossing vragen en zelf de pootjes omhoog leggen ofzo? je zou eens wat kunnen opzoeken over GD, dan zul je wel zien dat je de mist in gaat op r26... 
                      
                
                    
                         
                    
                    
                        
                            Jero3n (laatste wijziging 10/04/2007 18:21)                             
                         
                     
                    
                        PHP interesse ik heb het zelf geschreven, nadat ik wat had gelezen over gd.
    
    
        
            
                
<?php
header("content-type: image/png"); 
function newimg($id, $width, $height) {
  $image = ImageCreate($width, $height); 
  $achtergrond = ImageColorAllocate($image, 255, 255, 255);
  $black = ImageColorAllocate($image, 0, 0, 0);
  
  ImageLine($image, 0, 0, $width, 0, $black); 
  ImageLine($image, 0, $height-1, $width, $height-1, $black);
  ImageLine($image, 0, 0, 0, $height-1, $black);
  ImageLine($image, $width-1, 0, $width-1, $height-1, $black);
  return $image;
}
function gaussian_blur($img, $times) {
  $i=0;
  for ($i=0; $i < $times; $i++){
    imagefilter($img, IMG_FILTER_GAUSSIAN_BLUR);
  }
  return $img;
}
function colorize($img, $red, $green, $blue) {
  imagefilter($img, IMG_FILTER_COLORIZE, $red, $green, $blue);
  return $img;
}
function create($img) {
  ImagePNG($img);
  imagedestroy($img);
}
$img = newimg(0, 500, 500);
$img = colorize($img, 0, 255, 0);
$img = gaussian_blur($img, 10);
echo create($img);
?>
 
             
            <?php 
header ( "content-type: image/png" ) ;   
function  newimg( $id ,  $width ,  $height )  { 
  $image  =  ImageCreate( $width ,  $height ) ;  
  $achtergrond  =  ImageColorAllocate( $image ,  255 ,  255 ,  255 ) ; 
  $black  =  ImageColorAllocate( $image ,  0 ,  0 ,  0 ) ; 
 
  ImageLine( $image ,  0 ,  0 ,  $width ,  0 ,  $black ) ;  
  ImageLine( $image ,  0 ,  $height - 1 ,  $width ,  $height - 1 ,  $black ) ; 
  ImageLine( $image ,  0 ,  0 ,  0 ,  $height - 1 ,  $black ) ; 
  ImageLine( $image ,  $width - 1 ,  0 ,  $width - 1 ,  $height - 1 ,  $black ) ; 
 
  return  $image ; 
} 
 
function  gaussian_blur( $img ,  $times )  { 
  $i = 0 ; 
  for  ( $i = 0 ;  $i  <  $times ;  $i ++ ) { 
    imagefilter( $img ,  IMG_FILTER_GAUSSIAN_BLUR) ; 
  } 
  return  $img ; 
} 
 
function  colorize( $img ,  $red ,  $green ,  $blue )  { 
  imagefilter( $img ,  IMG_FILTER_COLORIZE,  $red ,  $green ,  $blue ) ; 
 
  return  $img ; 
} 
 
function  create( $img )  { 
  ImagePNG( $img ) ; 
  imagedestroy( $img ) ; 
} 
 
$img  =  newimg( 0 ,  500 ,  500 ) ; 
$img  =  colorize( $img ,  0 ,  255 ,  0 ) ; 
$img  =  gaussian_blur( $img ,  10 ) ; 
 
?> 
 
         
     
   
                      
                
                    
                         
                    
                        
		
		
	             
 
                
Dit onderwerp is gesloten .