Guest User

Untitled

a guest
Dec 14th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. imagedestroy(): supplied argument is not a valid Image resource
  2. imagecopy(): supplied argument is not a valid Image resource
  3. imagejpeg(): supplied argument is not a valid Image resource
  4.  
  5. <?php
  6. $posiX=400;
  7. $posiY=150;
  8.  
  9. $logo="http://dominio.com/images/ejemplo.png";
  10. $fondo"http://dominio.com/images/ejemplo.jpg";
  11. foto($fondo, $logo, $posiX, $posiY);
  12.  
  13. function foto($img_original, $marcadeagua, $posiX, $posiY){
  14.  
  15.  
  16. list($old_x, $old_y, $type) = getimagesize($img_original);
  17. switch ($type)
  18. {
  19. case 'jpg': // gif -> jpg
  20. $src_img = imagecreatefromjpg($img_original);
  21. break;
  22.  
  23. case 'jpeg': // jpeg -> jpg
  24. $src_img = imagecreatefromjpeg($img_original);
  25. break;
  26.  
  27. case 'png': // png -> jpg
  28. $src_img = imagecreatefrompng($img_original);
  29. break;
  30. }
  31.  
  32. //tomar el origen (logo)
  33. $marcadeagua= imagecreatefrompng($marcadeagua);
  34.  
  35. //las posiciones en donde ubicar - se reciben por POST
  36. $xmarcaagua = $posiX;
  37. $ymarcaagua = $posiY;
  38.  
  39. //se obtiene el ancho y el largo del logo
  40. $ximagen = 400;
  41. $yimagen = 150;
  42.  
  43. //COPIAR (observar las variables que se usan)
  44. imagecopy($imgm, $marcadeagua, $xmarcaagua, $ymarcaagua,0, 0,
  45. $ximagen, $yimagen);
  46.  
  47.  
  48. //Generar el archivo
  49. imagejpeg($imgm, '../images/originalrand.jpg');
  50.  
  51.  
  52. //faltaba destruirla (hay que ser prolijos)
  53. imagedestroy( $imgm );
  54. }
  55.  
  56.  
  57. ?>
Add Comment
Please, Sign In to add comment