Write to a log file with PHP

After writing custom PHP “log” function several times I finally decided to create a simple Logging PHP class. First call of lwrite method will open log file implicitly and write line to the file. Every other lwrite will use already opened file pointer until closing file with lclose. It is always a good idea to close file when it’s done. This should prevent file from corruption and overhead in closing file is negligible.

Resize images with PHP script

Did you ever try to resize many images at once? I did, and I wrote PHP script for that purpose. Anyway, after I selected few images from my photo album, I realized that every image was about 500KB and resolution of 1600×1200. This seems too big. Images should be smaller and lighter for upload.