Multimedia
If you have previously only used PHP to work with HTML content, it will come as a nice surprise that working with multimedia content uses almost exactly the same process. It seems that many people just don't realise that PHP is capable of handling much more than non-HTML data, and hopefully this chapter will help shed a great deal of light on this exciting and challenging topic.
Through its extensions, PHP is able to easily handle creating image data in a variety of formats, generating Flash movies, and even generating PDFs - each have their own advantages and disadvantages, and are all in popular use. Having the ability to create custom multimedia content on the fly is very powerful indeed - although outputting content to HTML can do a lot, a picture says a thousand words! For example, by generating multimedia content, we can create dynamic weather forecasts, or user-customised PDFs - the possibilities are endless.
Note that in order to work with multimedia, you must first understand that each type of content, whether it be images, Flash, or PDF, all have their own unique file formats that need to be absolutely precise - you must be careful not to use any text in your multimedia PHP scripts, not even extra blank lines before or after your <?php and ?> tags. The RTF format allows text formatting to be contained using special text encoding characters, and therefore can be manipulated using simple string routines.
Topics covered in this chapter are:
-
The multimedia formats that are available and their advantages
-
Creating basic image formats
-
Working with the rich-text format (RTF)
-
Creating portable document format (PDF) files
-
Working with the Shockwave Flash (SWF) format
Chapter contents
- 11.1. Brief history of web media
- 11.2. Images
- 11.2.1. Creating new images
- 11.2.2. Choosing a format
- 11.2.3. Getting arty
- 11.2.4. More shapes
- 11.2.5. Complex shapes
- 11.2.6. Outputting text
- 11.2.7. Loading existing images
- 11.2.8. Colour and image fills
- 11.2.9. Adding transparency
- 11.2.10. Using brushes
- 11.2.11. Basic image copying
- 11.2.12. Scaling and rotating
- 11.2.13. Points and lines
- 11.2.14. Updating the drawing script
- 11.2.15. Special effects using imagefilter()
- 11.2.16. Introduction to special effects using simple algorithms
- 11.2.17. Special FX, Colour reduction
- 11.2.18. Special FX, Interlacing
- 11.2.19. Special FX, Screen
- 11.2.20. Special FX, Greyscale
- 11.2.21. Special FX, Duotone
- 11.2.22. Special FX, Noise
- 11.2.23. Special FX, Scatter
- 11.2.24. Special FX, Pixelate
- 11.2.25. Special FX, Blur
- 11.2.26. Special FX, Other special effects
- 11.2.27. Interlacing an image
- 11.2.28. Getting an image's MIME type
- 11.2.29. Keeping your files small
- 11.2.30. Making graphs
- 11.3. Working with RTF
- 11.4. Creating PDF documents
- 11.4.1. There's more than one way to do it
- 11.4.2. Getting started
- 11.4.3. Adding more pages and more style
- 11.4.4. Adding imagery
- 11.4.5. PDF special effects
- 11.4.6. Adding document data
- 11.4.7. PDF Conclusion
- 11.4.8. Point sizes in real life
- 11.4.9. ClipPDF interoperability
- 11.4.10. PDF without a module?
- 11.5. Creating Flash
- 11.5.1. A simple movie
- 11.5.2. Flashy text
- 11.5.3. Actions
- 11.5.4. Animation
- 11.5.5. Flash Conclusion
- 11.6. Summary
- 11.7. Exercises
- 11.8. Further reading
- 11.9. Next chapter
Next chapter: Brief history of web media >>
Previous chapter: Next chapter
Jump to:
Home: Table of Contents



Copyright 2012 Future Publishing Limited (company
registered number 2008885), a company registered
in England and Wales whose registered office is at
Beauford Court, 30 Monmouth Street, Bath, BA1 2BW, UK