Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- imagedestroy(): supplied argument is not a valid Image resource
- imagecopy(): supplied argument is not a valid Image resource
- imagejpeg(): supplied argument is not a valid Image resource
- <?php
- $posiX=400;
- $posiY=150;
- $logo="http://dominio.com/images/ejemplo.png";
- $fondo"http://dominio.com/images/ejemplo.jpg";
- foto($fondo, $logo, $posiX, $posiY);
- function foto($img_original, $marcadeagua, $posiX, $posiY){
- list($old_x, $old_y, $type) = getimagesize($img_original);
- switch ($type)
- {
- case 'jpg': // gif -> jpg
- $src_img = imagecreatefromjpg($img_original);
- break;
- case 'jpeg': // jpeg -> jpg
- $src_img = imagecreatefromjpeg($img_original);
- break;
- case 'png': // png -> jpg
- $src_img = imagecreatefrompng($img_original);
- break;
- }
- //tomar el origen (logo)
- $marcadeagua= imagecreatefrompng($marcadeagua);
- //las posiciones en donde ubicar - se reciben por POST
- $xmarcaagua = $posiX;
- $ymarcaagua = $posiY;
- //se obtiene el ancho y el largo del logo
- $ximagen = 400;
- $yimagen = 150;
- //COPIAR (observar las variables que se usan)
- imagecopy($imgm, $marcadeagua, $xmarcaagua, $ymarcaagua,0, 0,
- $ximagen, $yimagen);
- //Generar el archivo
- imagejpeg($imgm, '../images/originalrand.jpg');
- //faltaba destruirla (hay que ser prolijos)
- imagedestroy( $imgm );
- }
- ?>
Add Comment
Please, Sign In to add comment