Archive for the ‘PHP/mySQL’ Category
Checkboxes/Multiple Select Boxes in PHP
Posted on June 19, 2006 by snipe in PHP/mySQL
For the PHP newbie, checkboxes and/or multiple select listboxes can be baffling in the beginning. It’s actually not very hard at all, and is often one of the PHP newbie’s first experience with arrays.
More About register_globals
Posted on June 23, 2005 by snipe in PHP/mySQL
If you’ve been directed to this page, that means that you’re complaining about how your variables in a POST or GET aren’t being carried over to the next page. You’ve been sent here because its an *extremely* common pitfall, and yet one that is exceptionally easy to work around if you know what to do [...]
Cropped Thumbnails using PHP and the GD Library
Posted on June 28, 2004 by snipe in PHP/mySQL
This code will allow you to create a thumbnail from a segment of the image. In some situations, you want to thumbnail an entire image – but other times, you may want only a piece – for example if you wish to generate square thumbnail images regardless of whether or not the original image is [...]
Dynamic Watermarks/Text Overlay on Images in PHP
Posted on June 27, 2004 by snipe in PHP/mySQL
This code can be useful for a number of things, such as making dynamic banners or for adding a copyright type of watermark to photographs or artwork (as we do in snipe gallery). As usual, this will not work for gifs unless you have a version of gd that lets you do that (cuz the [...]
Dynamic thumbnailing with PHP and the GD library
Posted on June 27, 2004 by snipe in PHP/mySQL
Although there are loads of ways you can do this, for this example, we’re assuming that the fullsize image is located in a directory called “images”, and the thumbnails will have the same name as the fullsize, but will be copied into a directory called “thumbs”. <?php // find out the current size info $photo_filename [...]
Dynamic thumbnailing with PHP and Imagemagick
Posted on June 27, 2004 by snipe in PHP/mySQL
This code formatting is a little off, since the WYSIWG editor seems to have eaten part of it. Sorry. <?php /* ———————————————- */ /* ———— BEGIN PHP SNIPPET —————-*/ /* ———————————————- */ // specify your file details $current_file = “image.jpg”; $max_width = “150″; // get the current info on the file $current_size = getimagesize($current_file); $current_img_width [...]
Sending HTML/Plain Text Mail Simultaneously using PHP
Posted on June 29, 2002 by snipe in PHP/mySQL
Although I expect this article to cause a few ruffled feathers amongst the programming community (since most of them are against HTML email), there are times when the client will ask for it anyway, so you have to know how to do it. We had run into difficulty finding a straight answer on this topic, [...]
Displaying file sizes in human readable format
Posted on June 27, 2002 by snipe in PHP/mySQL
This code prints out “b” for bytes, “m” for megs, etc depending on the file size.
Truncate text to x number of words
Posted on June 27, 2002 by snipe in PHP/mySQL
This code will truncate given text to a certain length, adding “…” where it’s been truncated. For example: Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Quisque ac urna a erat pharetra placerat. Sed at tortor id lacus pellentesque malesuada. Suspendisse vitae dui vel velit tincidunt aliquet. Cras condimentum lobortis leo. Integer semper. Nunc semper [...]
Google Style Page Numbering (with x per page and y page numbers displayed)
Posted on June 27, 2002 by snipe in Featured, PHP/mySQL
With just a few modifications, we can create a piece of code that will not only give you x results per page with page numbers, but it will also allow you to specify how many page numbers should appear on the page at any time, much like Google. (For example, if you have hundreds of [...]
Page Numbering (with x results per page)
Posted on June 27, 2002 by snipe in PHP/mySQL
Although there are several examples of this type of code to be found online, I had never found one that easily did what I needed and was flexible enough that we only had to change a few things to use it again – so I wrote my own. It links each page number (except for [...]


