Hi Guys,
I'm resizing an image with "imagecopyresampled".
But i want base64_encode data in return without creating TEM file.
function resizeImage($filename, $new_path, $w, $h){ list($width, $height) = getimagesize($filename); $new_width = $w; $new_height = $h; $image = imagecreatefrompng($filename); $image_p = imagecreatetruecolor($w,$h); imagealphablending($image_p, false); imagesavealpha($image_p, true); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); imagepng($image_p, $new_path); imagedestroy($image); imagedestroy($image_p); $ret = base64_encode(file_get_contents($new_path)); return $ret;}
In this code, i'm creating a TEMP file.
But this method is too heavy for me.
imagepng($image_p, 'I DONT WANT to CREATE any TEMP FILE');
I tried ob_get_content examples, but i failed :/
Please guide.
Specially waiting replies from my ever loving teachers: thescientist & justsomeguy