Jump to content

[SOLVED] save image


zhahaman2001

Recommended Posts

<?php 
$im = imagecreate (250, 28); 
$black = ImageColorAllocate ($im, 0, 0, 0); 
$yellow = ImageColorAllocate ($im, 235, 235, 51); 
ImageTTFText ($im, 20, 0, 10, 20, $yellow, "/WINDOWS/Fonts/IMPACT.ttf", 
              "IMPACT FONT HIP HIP Hurray!!!"); 
ImagePNG($im); 
?> 

I got that code to work but how would I save that image to a dir like /images ?

Link to comment
https://forums.phpfreaks.com/topic/43587-solved-save-image/
Share on other sites

bool imagepng ( resource $image [, string $filename [, int $quality [, int $filters]]] )

 

So I think the usage would be like this

 

<?php
$im = imagecreate (250, 28); 
$black = ImageColorAllocate ($im, 0, 0, 0); 
$yellow = ImageColorAllocate ($im, 235, 235, 51); 
ImageTTFText ($im, 20, 0, 10, 20, $yellow, "/WINDOWS/Fonts/IMPACT.ttf", 
              "IMPACT FONT HIP HIP Hurray!!!"); 
ImagePNG($im, '/dir/to/save/image.png'); 
?>

 

It should save it under /dir/to/save/image.png

Link to comment
https://forums.phpfreaks.com/topic/43587-solved-save-image/#findComment-211688
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.