I have yet to invest in a full-fledged graphics software package like Adobe PhotoShop as I’ve always been far more interested in programming than creating images. Yet there are times when you may need to create an image fast. You can of course use PHP to create images, but I’m going to explore what I did today to create an image for updating my latest post about compression using ob_gzhandler().
I realized that it would be nice to have an image showing what kind of output you can expect to see from running phpinfo() as regards the zlib extension. So, the first thing I did was to click the phpinfo link on my wampserver Server Configuration page. Alternatively, I could have created a PHP script using the phpinfo().
I then did a view-source of the resulting output and pasted the HTML into my old editor Homsite5 which I am still partial to, perhaps out of nostalgia for the old dot-com boom days. In my editor, I basically cut away all the tables except for the one showing the zlib info. Then I browsed the HTML within Homesite using the default internal browser which is MSIE, although I could have just as easily browsed the code in my default external browser which is Firefox.
While browsing the content, I captured the screen output by pressing on the keyboard PrtScrn/SysRq key. By pressing that key, an image is created and saved to the Windows Clipboard, a temporary area in memory.
Since I am using Windows XP, I was able to paste the captured image into MS Word 2003 and what happens is that the resulting image will be in a bitmap format. In MS Word I used the picture toolbar’s crop tool to cut away anything extraneous to the pic. Next, I copied the image and pasted it into the window’s accessory Paint.
Paint is a very basic graphics editor and very easy to use. Using the “Stretch and Skew” feature, I resized the graphic to 90% of its height and width, a step I repeated twice to get something that would comfortably fit in my blog. Lastly, I saved the pic initally as a GIF and subsquently rethought that decision. I ended up copying from the image in MS Word again, repeated the same steps to adjust the height and width in Paint, finally saved the image as a PNG which looks much better than the GIF did.
While this explanation may seem full of tedious detail, it is actually fast and easy to generate an image in this way.