Fabriciool

vlwflw

Oct 3rd, 2013
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. /*
  2. bybusiness
  3. */
  4.  
  5. <?php
  6.  
  7. // caminho facilitado das duas imagens
  8. $filename1 = '1.jpg';
  9. $filename2 = '2.jpg';
  10.  
  11. // configurar o tipo de documento
  12. header('Content-Type: image/jpeg');
  13.  
  14. // pegar tammanho das duas imagens para tratamento
  15. list($width1, $height1) = getimagesize($filename1);
  16. list($width2, $height2) = getimagesize($filename2);
  17.  
  18. $source1 = imagecreatefromjpeg($filename1);
  19. $source2 = imagecreatefromjpeg($filename2);
  20.  
  21. // cria uma imagem preta com tamanho que ocupe as duas imagens
  22. $fundo = imagecreatetruecolor($width1 + $width2, $height1 + $height2);
  23.  
  24. // copia primeira imagem logo no inicio
  25.  
  26. imagecopyresized($fundo, $source1, 0, 0, 0, 0, $width1, $height1, $width1 + $width2, $height1 + $height2); // a soma de h1+h2 e w1+w2 é para houver espaço paras duas imagens
  27. imagecopyresized($fundo, $source2, $width1 / 2 , 0, 0, 0, $width2, $height2, $width1 + $width2, $height1 + $height2); // o w / 2 serve para colocar a coordenada inicial da imagem $source2 logo após a $source1
  28.  
  29. // imprimir a imagem
  30. imagejpeg($fundo );
  31.  
  32. ?>
Advertisement
Add Comment
Please, Sign In to add comment