DiamondDog: Problem mit Bidlgröße

Beitrag lesen

Hallo Leute,
ich hab ein kleines Problem und zwar habe ich ein kleines Wasserzeichen Script welches an sich auch funktioniert. Das einzigste Problem welches ensteht is das wenn das bild kleiner ist als das Wasserzeichen das dann das Wasserzeichen nur halb über das Bild ragt.

Meien Frage ist wie bekomme ich es hin, das das Wasserzeichen der größe des Bildes auf das es kommt angepasst wird, so das es ganz zu sehen ist?

Hoffe mir kann jemand Helfen, schon mal ein Danke an alle.

Hier mal das Script:

  
<?PHP  
  $strImageDestination =   'img/'.$_GET['file'];  
  $strImageWatermark =  'wasserzeichen.gif';  
  
  $iTransparency = 65;  
  if ( !empty ( $_GET['t'] ) )  
  {  
    $iTransparency = $_GET['t'];  
  }  
  
  $iQuality = 80;  
  if ( !empty ( $_GET['q'] ) )  
  {  
    $iQuality = $_GET['q'];  
  }  
  
  list ( $iDestinationWidth, $iDestinationHeight,  
  $iDestinationType ) = getimagesize ( $strImageDestination );  
  list ( $iWatermarkWidth, $iWatermarkHeight,  
  $iWatermarkType ) = getimagesize ( $strImageWatermark );  
  
  switch ( $iDestinationType )  
  {  
    case 1:  
      $rDestination = imagecreatefromgif ( $strImageDestination );  
      break;  
    case 2:  
      $rDestination = imagecreatefromjpeg ( $strImageDestination );  
      break;  
    case 3:  
      $rDestination = imagecreatefrompng ( $strImageDestination );  
  }  
  
  switch ( $iWatermarkType )  
  {  
    case 1:  
      $rWatermark = imagecreatefromgif ( $strImageWatermark );  
      break;  
    case 2:  
      $rWatermark = imagecreatefromjpeg ( $strImageWatermark );  
      break;  
    case 3:  
      $rWatermark = imagecreatefrompng ( $strImageWatermark );  
  }  
  
  switch ( $_GET['p'] )  
  {  
    case 1:  
      $iPositionX = 0;  
      $iPositionY = 0;  
      break;  
    case 2:  
      $iPositionX = $iDestinationWidth - $iWatermarkWidth;  
      $iPositionY = 0;  
      break;  
    case 3:  
      $iPositionX = 0;  
      $iPositionY = $iDestinationHeight - $iWatermarkHeight;  
      break;  
    case 4:  
      $iPositionX = $iDestinationWidth - $iWatermarkWidth;  
      $iPositionY = $iDestinationHeight - $iWatermarkHeight;  
      break;  
    case 5:  
	default:  
      $iPositionX = ceil ( ( $iDestinationWidth / 2 ) );  
      $iPositionX -= ceil ( ( $iWatermarkWidth / 2 ) );  
  
      $iPositionY = ceil ( ( $iDestinationHeight / 2 ) );  
      $iPositionY -= ceil ( ( $iWatermarkHeight / 2 ) );  
  }  
  
  $iTransparency = 100 - $iTransparency;  
  
  imagecopymerge ( $rDestination, $rWatermark, $iPositionX,  
                   $iPositionY, 0, 0, $iWatermarkWidth,  
                   $iWatermarkHeight, $iTransparency );  
  
  switch ( $_GET['r'] )  
  {  
    case 1:  
      header ( 'content-type: image/gif' );  
      imagegif ( $rDestination );  
      break;  
    case 2:  
      header ( 'content-type: image/jpeg' );  
      imagejpeg ( $rDestination, '', $iQuality );  
      break;  
    case 3:  
    default:  
      header ( 'content-type: image/png' );  
      imagepng ( $rDestination );  
  }  
  
  imagedestroy ( $rDestination );  
  imagedestroy ( $rWatermark );  
?>  

Mfg Dog

PS: Ich hab schon einiges über imagecopyresized gelesen, aber hinbekommen tuh ich es trozdem irgendwie nicht.