13.09.2016 Views

PHP and MySQL Web Development 4th Ed-tqw-_darksiderg

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

xxvi<br />

Contents<br />

22 Generating Images 483<br />

Setting Up Image Support in <strong>PHP</strong> 484<br />

Underst<strong>and</strong>ing Image Formats 484<br />

JPEG 485<br />

PNG 485<br />

WBMP 485<br />

GIF 485<br />

Creating Images 486<br />

Creating a Canvas Image 487<br />

Drawing or Printing Text on the Image 487<br />

Outputting the Final Graphic 489<br />

Cleaning Up 490<br />

Using Automatically Generated Images in Other<br />

Pages 490<br />

Using Text <strong>and</strong> Fonts to Create Images 491<br />

Setting Up the Base Canvas 495<br />

Fitting the Text onto the Button 495<br />

Positioning the Text 498<br />

Writing the Text onto the Button 499<br />

Finishing Up 499<br />

Drawing Figures <strong>and</strong> Graphing Data 499<br />

Using Other Image Functions 507<br />

Further Reading 507<br />

Next 508<br />

23 Using Session Control in <strong>PHP</strong> 509<br />

What Is Session Control? 509<br />

Underst<strong>and</strong>ing Basic Session Functionality 509<br />

What Is a Cookie? 510<br />

Setting Cookies from <strong>PHP</strong> 510<br />

Using Cookies with Sessions 511<br />

Storing the Session ID 511<br />

Implementing Simple Sessions 512<br />

Starting a Session 512<br />

Registering Session Variables 513

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!