Skip to content

WYSIWYG images empty

Oliver Georgi edited this page Jan 11, 2017 · 4 revisions

If your PHP version was upgraded to version 5.5 or 5.6 and images in the WYSIWYG editor are no longer rendered check the version of the file /image_resized.php. There you might find several GD related functions like imagepng(), imagejpeg()and imagegif(). Check the second parameter — if it looks like ($new_img, '', …) you have to replace '' by null.

Before, around line 115 (might not be 1:1 identical to your version):

	switch($img_target) {
		case 'jpg':	imagejpeg($new_img, '', $img_quality);
				break;
		case 'png':	imagepng($new_img, '', 9);
				break;
		case 'gif':	imagegif($new_img);
				break;
	}

	imagedestroy($new_img);
	imagedestroy($img_source);

} else {

	// error / no image
	header ('Content-type: image/png');
	$new_img = imagecreatetruecolor(75, 20);
	$text_color = imagecolorallocate($new_img, 255, 255, 255);
	imagestring($new_img, 1, 5, 5,  "Image Error", $text_color);
	imagepng($new_img, '', 9);

Change it to:

	switch($img_target) {
		case 'jpg':	imagejpeg($new_img, null, $img_quality);
				break;
		case 'png':	imagepng($new_img, null, 9);
				break;
		case 'gif':	imagegif($new_img);
				break;
	}

	imagedestroy($new_img);
	imagedestroy($img_source);

} else {

	// error / no image
	header ('Content-type: image/png');
	$new_img = imagecreatetruecolor(75, 20);
	$text_color = imagecolorallocate($new_img, 255, 255, 255);
	imagestring($new_img, 1, 5, 5,  "Image Error", $text_color);
	imagepng($new_img, null, 9);