Saving php created graphics [SOLVED]

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
User avatar
cturner
Forum Contributor
Posts: 153
Joined: Sun Jul 16, 2006 3:03 am
Location: My computer

Saving php created graphics [SOLVED]

Post by cturner »

Can someone please tell me how I can save a php created image to another folder other than the php code folder? I desperately need to see code not a link. Thanks in advance.

Here is my code:

Code: Select all

function makeimage ($title3, $im) {
    $im = @imagecreate(110, 23) or die('Cannot Initialize new GD image stream.');
    imagecolorallocate($im, 0, 57, 122);
    $tc = imagecolorallocate($im, 255, 255, 255);
    imagestring($im, 3, 10, 5,  $name, $tc);
    imagejpeg ($im, '/images/'.$title3.'btn.jpeg');
    imagedestroy($im);
}
    makeimage ($title3, $im);
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

You can save it anywhere you want, using the second parameter of imagejpeg()
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Your code already wishes to place it in /images. Now that would be in the root of the server, not the root of the website. $_SERVER['DOCUMENT_ROOT'] may be useful here if you wish to place the file in your website's root.
User avatar
cturner
Forum Contributor
Posts: 153
Joined: Sun Jul 16, 2006 3:03 am
Location: My computer

Post by cturner »

The problem is now solved. The solution was taking the first / out of imagejpeg ($im, '/images/'.$title3.'btn.jpeg');.
Post Reply