I am trying to add a watermark on an image using phpThumb in PHP8.2 and getting following error:
$gdimg_hexcolorallocate is not a GD resource in ImageHexColorAllocate()
Following is the code which I have tried:
include_once 'phpThumb/phpthumb.class.php';
$phpThumb = new phpThumb();
$phpThumb->setSourceFilename( dirname( __FILE__ ) . '/phpThumb/images/img-captcha.png' );
$font_file = dirname( __FILE__ ) . '/phpThumb/fonts/opensans-extrabold-webfont.ttf';
$phpThumb->setParameter( 'fltr',array('wmt|test|13.5|C|#000000|'.$font_file.'|100|5|0|#000000||1.0'));
$phpThumb->setParameter( 'w', '200' );
$phpThumb->setParameter( 'h', '100' );
$phpThumb->setParameter( 'config_output_format', 'png' );
$image_name = 'captcha_' . time() . '_' . $thumbnail_width . '.' . $phpThumb->config_output_format;
$output_filename = $base_path . '/cache/captcha/' . $image_name;
$phpThumb->GenerateThumbnail();
$phpThumb->RenderToFile( $output_filename );