DiamondDog: Problem mit Bidlgröße

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.

  1. Hi,

    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?

    In dem du die Maße von Bild und Wasserzeichen vergleichst, und dann entsprechend darauf reagierst.

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

    Und gezeigt hast du uns von deinem Versuch, es zu benutzen, auch nichts.

    Dürfen wir davon ausgehen, dass das gezeigte Script auch nicht von dir ist?

    MfG ChrisB

    --
    RGB is totally confusing - I mean, at least #C0FFEE should be brown, right?
    1. Moin,

      Dürfen wir davon ausgehen, dass das gezeigte Script auch nicht von dir ist?

      Dürfen wir.

      Grüße Marco

      1. So jetzt mal an alle das Problem was ich habe sieht so aus:
        http://www.diamonddoghamm.de/test/
        Das Wasserzeichen ist viel zu große und wird nicht angepasst.
        Eigendlich muß ich nur wissen wie ich das Wasserzeichen vor dem einfügen auf dem Img kleiner bekomme.

        1. Edit:
          Orginal Bildpfad:
          www.diamonddoghamm.de/test/img/Duke Nukem 3D.gif
          Orginal Wasserzeichenpfad:
          http://www.diamonddoghamm.de/test/wasserzeichen.gif

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

    Na dann ist das Problem doch eindeutig: Du tust es irgendwie falsch machen. SCNR