Ver Mensaje Individual
  #2 (permalink)  
Antiguo 28/05/2012, 04:45
bruno911
 
Fecha de Ingreso: mayo-2004
Mensajes: 102
Antigüedad: 20 años
Puntos: 5
Respuesta: Editor imágenes php

Intenta asi:

<?php
function watermarkImage ($SourceFile, $WaterMarkText, $DestinationFile) {
list($width, $height) = getimagesize($SourceFile);
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($SourceFile);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width, $height);
$black = imagecolorallocate($image_p, 0, 64, 128);
$font = 'arial.ttf';
$font_size = 12;
$left = ($width / 3) ;
$top = ($height / 2) ;

$bot = ($top * 2) ;
$fbop=$bot-5;

imagettftext($image_p, $font_size, 0, $left, $fbop, $black, $font, $WaterMarkText);


if ($DestinationFile<>'') {
imagejpeg ($image_p, $DestinationFile, 100);
echo "<meta http-equiv=refresh content=0;url=http://localhost/$DestinationFile>";
} else {
header('Content-Type: image/jpeg');
imagejpeg($image_p, null, 100);
};
imagedestroy($image);
imagedestroy($image_p);
};
?>
<?php
$upload=$_POST['img-url'];
$SourceFile = $upload;
$rnd=rand(0,999999);
$rnd2=$rnd*2;
$rndR=rand(0,987);
$rnd3=$rnd2-$rndR;
$var="_elcoso";
$var2="_$rnd2";
$var3="_$rnd3";
$DestinationFile = "$rnd".$var."$var2"."$var3".".jpg";
$WaterMarkText = 'MARCADEAGUA.com';

watermarkImage ($SourceFile, $WaterMarkText, $DestinationFile);
?>


A simple vista podria ser este el problema ya qeu estas llamando a la funcion antes de que se carge.
Prueba y si no funciona avisa, saludos!
__________________
Bruno Quintana