Linked by Tony Steidler-Dennison on Mon 7th Jul 2008 18:13 UTC, submitted by jmalasko
General Development Imagine creating Web-page graphics dynamically using just code. Creating and manipulating images is yours for the doing with the power of PHP. This tutorial steps through using the GD library, showing you how to create and alter images on Web pages. It starts with the GD construct, and then builds on it to showcase graphics techniques.
Order by: Score:
Leopard & GD
by Kroc on Mon 7th Jul 2008 19:43 UTC
Kroc
Member since:
2005-11-10

For some reason, Apple did not include GD in the default Leopard build. Here's how to compile just the GD extension and add it to PHP without recompiling the whole of PHP and breaking the unique folder layout &c. of the Apple install

cd "`dirname "$0"`"

mkdir -p libjpg
cd libjpg
curl -O http://www.ijg.org/files/jpegsrc.v6b.tar.gz
tar xzpf jpegsrc.v6b.tar.gz
cd jpeg-6b
cp /usr/share/libtool/config.sub .
cp /usr/share/libtool/config.guess .

#32-bit
#./configure --enable-shared
#64-bit
MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS="-arch x86_64 -g -Os -pipe -no-cpp-precomp" CCFLAGS="-arch x86_64 -g -Os -pipe" CXXFLAGS="-arch x86_64 -g -Os -pipe" LDFLAGS="-arch x86_64 -bind_at_load" ./configure --enable-shared

make
mkdir -p /usr/local/include
mkdir -p /usr/local/bin
mkdir -p /usr/local/lib
mkdir -p /usr/local/man/man1
sudo make install

cd ..
cd ..
mkdir -p gd
cd gd
curl -O http://www.opensource.apple.com/darwinsource/10.5/apache_mod_php-43/php-5.2 .4.tar.bz2
tar xjf php-5.2.4.tar.bz2
cd php-5.2.4/ext/gd
sudo phpize

#32-bit
#./configure --with-zlib-dir=/usr --with-jpeg-dir=/usr/local/lib --with-png-dir=/usr/X11R6 --with-freetype-dir=/usr/X11R6 --with-xpm-dir=/usr/X11R6
#64-bit
MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS="-arch x86_64 -g -Os -pipe -no-cpp-precomp" CCFLAGS="-arch x86_64 -g -Os -pipe" CXXFLAGS="-arch x86_64 -g -Os -pipe" LDFLAGS="-arch x86_64 -bind_at_load" ./configure --with-zlib-dir=/usr --with-jpeg-dir=/usr/local/lib --with-png-dir=/usr/X11R6 --with-freetype-dir=/usr/X11R6 --with-xpm-dir=/usr/X11R6

make
sudo make install

#add "extension=gd.so" to php.ini
#and uncomment (";" before) 'extension_dir = "./"'


uncomment the 32-bit lines, and comment in the 64-bit lines if you're compiling on a Core !2 Duo / G4

Edited 2008-07-07 19:47 UTC

Reply Score: 2

RE: Leopard & GD
by StephenBeDoper on Mon 7th Jul 2008 23:57 UTC in reply to "Leopard & GD"
StephenBeDoper Member since:
2005-07-06

Yeesh! Must... resist... urge to... make... snarky comment... about... "The Mac Experience." ;)

Reply Score: 0

RE[2]: Leopard & GD
by BallmerKnowsBest on Tue 8th Jul 2008 02:21 UTC in reply to "RE: Leopard & GD"
BallmerKnowsBest Member since:
2008-06-02

The appropriate reference is:

"So easy to use, no WONDER it's number 1!"

Hey, it worked for AOL.

Reply Score: 1

RE[2]: Leopard & GD
by chrish on Tue 8th Jul 2008 12:56 UTC in reply to "RE: Leopard & GD"
chrish Member since:
2005-07-14

'cause your grandma is clearly going to need to install GD, right? ;-)

Reply Score: 1

RE[3]: Leopard & GD
by StephenBeDoper on Tue 8th Jul 2008 13:47 UTC in reply to "RE[2]: Leopard & GD"
StephenBeDoper Member since:
2005-07-06

Ah, I wasn't aware that "good user experience" has grandparent-only eligibility requirements.

Reply Score: 2

RE[2]: Leopard & GD
by Kroc on Wed 9th Jul 2008 08:14 UTC in reply to "RE: Leopard & GD"
Kroc Member since:
2005-11-10

This is PHP/Apache. Both open source projects not run by Apple. These are also both not front-facing user options advertised on the box.

Having to run a ridiculously complex script to fix an issue is a staple of most open source projects. Blaming Apple is aiming in the wrong place.

Reply Score: 2

RE[3]: Leopard & GD
by StephenBeDoper on Fri 11th Jul 2008 21:29 UTC in reply to "RE[2]: Leopard & GD"
StephenBeDoper Member since:
2005-07-06

This is PHP/Apache. Both open source projects not run by Apple.
...
Blaming Apple is aiming in the wrong place.


Apple is responsible for the configuration of the versions of PHP/Apache that Apple chose to include in Apple's OS (note the pattern).

Having to run a ridiculously complex script to fix an issue is a staple of most open source projects.


Relevance? Correlation is not cause.

These are also both not front-facing user options advertised on the box.


...which says to me that Apple's commitment to "user experience" is largely perfunctory, since it evidently doesn't extend to the more advanced / less "sexy" parts of the OS.

Reply Score: 2

where's the actual tutorial
by mckill on Mon 7th Jul 2008 21:57 UTC
mckill
Member since:
2007-06-12

so how do i actually view IBM's tutorial, do i have to sign up for it? am i retarded or something.

Reply Score: 2

RE: where's the actual tutorial
by mongoslam on Tue 8th Jul 2008 01:01 UTC in reply to "where's the actual tutorial"
mongoslam Member since:
2006-11-30

Yeah. Do that by clicking the "Register now or sign in using your IBM ID and password." link.

- This message has been presented by RTARD foundation. (I only kid.)

Reply Score: 1

Two ready-made scripts
by StephenBeDoper on Tue 8th Jul 2008 00:10 UTC
StephenBeDoper
Member since:
2005-07-06

I've been using this for about a year or so now - it's incredibly useful when you need to do something like display dynamically-generated text using an exotic typeface.

A very useful script that I've come across, just in case anyone is looking for something similar:

- Multifunction Image Handler PHP Script
http://www.carmosaic.com/weather/scripts-image-handler.php

I haven't used more than a fraction of its functionality, but so far it's been quite handy for doing server-side creation of banner images from templates, and non-destructively watermarking photos.

Reply Score: 2

Registration required
by fresch on Tue 8th Jul 2008 07:26 UTC
fresch
Member since:
2006-09-12

I would like to suggest to not post items or articles that reference material for which one needs to register in any way.

I find it extremely annyoing having to register for any and every tiny bit of information.

Reply Score: 5