How to save a copy of an image when using gd php library

0

I need to save 2 images one edited and one unedited. when editing my image with imagecreatefromjpeg ($ img); I would like to keep it in the same directory with another name to have the 2 images. The edited and the original.

    
asked by Eduardo Jesus 11.08.2016 в 04:47
source

1 answer

0

I would recommend that you do it in two steps:

1.- Save the image that you upload in the folder you want

copy($_FILES['txtfile']['tmp_name'], $dirdestino);

2.- Then with the GD library, save the retouched image

imagecopyresampled($imagen_nueva, $imagen_vieja, 0, 0, 0, 0,$nuevo_ancho, $nuevo_alto, $ancho, $alto);
imagejpeg($imagen_nueva,$destino);
imagedestroy($imagen_nueva);
imagedestroy($imagen_vieja);

If you put the code you have, it may also be easier to help you

    
answered by 11.08.2016 в 19:05