Jump to content

ImageCreateFrom


asmith

Recommended Posts

for jpg and png images you can do this:

 

<?php
imagejpeg($sourceImg, NULL, 100); // Souce, File location (Unless NULL), Quality in percent

imagepng($sourceImg, NULL, 100); // Souce, File location (Unless NULL), Quality in percent
?>

 

gif images you can't control quality

Link to comment
https://forums.phpfreaks.com/topic/85157-imagecreatefrom/#findComment-434642
Share on other sites

imagecreatefromjpeg use for captcha background .

you can set image for a captcha background instead of solid colors (createimagetruecolors)

 

but when you use bacground it reduce the image quality !! but i see some captcha everywhere they are perfect in quality , don't know why this function doen't work !

please help !

Link to comment
https://forums.phpfreaks.com/topic/85157-imagecreatefrom/#findComment-434718
Share on other sites

$image = imagecreatefromJPEG("image.jpg");

// set colors
$white 	= ImageColorAllocate($image, 255, 255, 255);
$black 	= ImageColorAllocate($image, 0, 0, 0);

imagettftext($image, 50, 0, 70, 140, $black, 'arial.TTF', $the_code);

// created image 
imagejpeg($image);
imagedestroy($image);

 

the first line reduces the image quality

Link to comment
https://forums.phpfreaks.com/topic/85157-imagecreatefrom/#findComment-434748
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.