<?php $img = imageCreateTrueColor(400, 350); header('Content-Type:image/jpeg'); imagejpeg($img, NULl, 100); ?> 

If you comment out the header, the image characters will be displayed

If you remove the comments, this appears: this

This code was written off from the video of the lesson, the author has a small black rectangle on a white background, I have everything in turn.

And when this black background appears, the title changes to the contents of the address bar.

Version php 7

  • Do you have the GD library included? - Let's say Pie
  • I have a semicolon in front of gd2 in my php.ini file - Just Account
  • $ im = @imagecreatetruecolor (120, 20) or die ('Unable to initialize GD stream'); - madfan41k
  • And why this NULl, 100 - Let's say Pie

1 answer 1

$bg = imagecolorallocate ($img, 255, 255, 255);

imagejpeg($bg, NULL, 100);

header("Content-Type: image/jpeg") Tells the browser that this is a jpeg image, not an html page.