i am new to php. i am trying to upload an image, resize it, and then display it without saving. i am using gd to do this. the codes provided here is just a basic approach for just the function to work.
<?php
if (!isset($_FILES['image']['tmp_name'])) {
}
else{
$file=$_FILES['image']['tmp_name'];
$img_src = imagecreatefromstring(file_get_contents($file));
$img_dest = imagecreatetruecolor(851, 315);
$src_width = imagesx($img_src);
$src_height = imagesy($img_src);
imagecopyresized($img_dest, $img_src, 0, 0, 0, 0, 851, 315, $src_width, $src_height);
$text= $_POST['text'];
$font_path = 'arial.TTF';
$grey = imagecolorallocate($img_dest, 128, 128, 128);
$black = imagecolorallocate($img_dest, 0, 0, 0);
imagettftext($img_dest, 25, 0, 302, 62, $grey, $font_path, $text);
imagettftext($img_dest, 25, 0, 300, 60, $black, $font_path, $text);
header( "Content-type: image/png" );
imagepng( $img_dest );
imagedestroy( $img_dest );
imagedestroy( $img_src );
}
?>
i am uploading an image through a form and running this script. the image is being displayed. but how can i display more than 1 images in different size using this method. with regards.