php image function help please

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
duroo
Forum Newbie
Posts: 3
Joined: Mon Jan 26, 2004 9:04 pm

php image function help please

Post by duroo »

how do i output a php generated image to a file instead of just displaying it on the page?
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

First, don't output the header that says the file is an image. Second, in the image creation call, imagepng,imagejpeg, or imagegif, put in a second argument that is the file name you want to create. I have heard of problems that people can't write to the file. A solution to THAT problem is to create a new directory with user, group, and world read/write/execute functions, and store the image in that directory. I found this out on php.net, so this rough solution is not mine.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply