Home  |  Linux  | Mysql  | PHP  | XML
From:Nathan Wallace Date:Thu Aug  5 06:49:44 1999
Subject:PHP Knowledge Base Update -- August 4th, 1999
The main php list really does get a lot of traffic.  4479 messages
during July, that's about 150 per day!

Cheers,

Nathan


------------------------------------------------------------
How can I scale an image to a different size in PHP?
How can I adjust the quality (and file size) of an image?
http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/539
------------------------------------------------------------
Opec Kemp, Markus Schulte, 
Richard Allsebrook, Justin Farnsworth

You can display an image as a different size just by setting the height
and width properties in the HTML IMG tag.  This results in the complete
file being downloaded regardless of the final image size however.  That
can make for some very large thumbnails...<g>

To adjust the image file size as well you'll need to install this lib on
your machine : Image Magick, it can be found at

    http://www.wizards.dupont.com/cristy/ImageMagick.html

Here's a quick run down from their web site:
    ImageMagickTM, version 4.2.8, is a robust collection of tools and
    libraries to read, write, and manipulate an image in any of the more 
    popular image formats including GIF, JPEG, PNG, PDF, and Photo CD. 
    With ImageMagick you can create GIFs dynamically making it suitable 
    for Web applications.

    You can also resize, rotate, sharpen, color reduce, or add special
    effects to an image and save your completed work in the same or
    differing image format.

    Here are just a few examples of what ImageMagick can do:
         * Convert an image from one format to another (e.g. TIFF to
           JPEG)
         * Resize, rotate, sharpen, color reduce, or add special effects 
           to an image
         * Create a montage of image tumbnails
         * Create a transparent image suitable for use on the Web
         * Turn a group of images into a GIF animation sequence
         * Create a composite image by combining several separate images
         * Draw shapes or text on an image
         * Decorate an image with a border or frame
         * Describe the format and characteristics of an image

The X11 libs are only required if you build the full ImageMagick
package, including the graphic viewer.  If all you're interested in is
the command-line tools, you can 'configure --without-x'

Once you install the neccessary libs, you will have a program called
"mogrifycation" which you can run from the command line. You can do all
sorts of img manipularion with this util ie resize, dither, reduce
resolution etc etc from the command line :).

So you could easily use the PHP system() call to execute the command and
get what you want.


------------------------------------------------------------
How cam I sort the contents of a file using PHP?
http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/541
------------------------------------------------------------
Vamsi Nath, Teodor Cimpoesu

You could use a system call:

    exec("cat db.txt | sort > db.txt");

or you can do the whole thing in PHP using:

    $db = file("db.txt");
    sort($db);
    $dbh = fopen("db.txt","w") || die("couldn't open");
    fwrite($dbh,implode($db,"\n");

Probably what you really want though is a database, especially if the
files will be large.


------------------------------------------------------------
Can I register more than one shutdown function?
http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/542
------------------------------------------------------------
Zeev Suraski

You can register as many shutdown functions as you wish, and they'll be
executed in the order they were registered.

    http://www.php.net/manual/function.register-shutdown-function.php3


------------------------------------------------------------
Can I use the shared memory and semaphore functions on Windows?
http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/543
------------------------------------------------------------
Egon Schmid

The semaphore and shared memory functions work only on Unix systems.



Navigate in group php.kb at sever news.php.net
Previous Next




  
© No Copyright
You are free to use Anything
Site Maintained by Zareef Ahmed
Powered By PHP Consultants