TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   Remembering the GD Library? (http://www.talkphp.com/general/2523-remembering-gd-library.html)

Nor 03-25-2008 04:23 PM

Remembering the GD Library?
 
Its hard to remember anyone got any tips on remembering basic GD?

Gareth 03-25-2008 04:38 PM

I would have a look at Rendair's absolutely amazing GD articles!

TalkPHP - The Big GD Guide - Part 1
TalkPHP - The Big GD Guide - Part 2
TalkPHP - The Big GD Guide - Part 3

Nor 03-25-2008 04:53 PM

I read them, but the fact of me remembering them is a hard task for some reason, like the only thing I can't remember PHP wise.

Gareth 03-25-2008 05:00 PM

We should make a "cheat sheet"!

Salathe 03-25-2008 05:01 PM

Make some notes keep them nearby when you're coding something. :-)

freenity 03-25-2008 06:00 PM

Don't know if all, but almost all GD functions start with image :)
imagecolorallocate.. imageline.. etc
and the arguments are pretty much the same
image resource, x, y, w, h
or
image resource from_x, from_y, to_x, to_y...

Salathe 03-25-2008 08:06 PM

Oh and bookmark: PHP: Image - Manual :-)

Rendair 03-25-2008 11:11 PM

What i do is think of an application that would need me to use alot of different GD functions and then just keep adding to it and sooner or later you kind of just remember them.

Orc 03-26-2008 12:01 AM

PHP Code:

<?php



/**
**  How to get an image from a resource
**/

# Set the header
header("Content-Type: image/png");
# if this is empty then it would return an error
$file 'test.jpg';
# create it from $file
$im imagecreatefromjpeg($file);

# Makes it easier for PNG files to have their colors correct!
imagesavealpha($im,true);

# generate it as a png file

imagepng($im);

/**End**/

/**
* Make your own IMages!~!!!!!! YAYYAYAY
**/# Set the header
header("Content-Type: image/jpeg");
$x 200;
$y 100;


$r mt_rand(0,255);
$g $r;
$b $g;


 
$im imagecreatetruecolor($x,$y);
 
$col imagecolorallocate($im$r,$g,$b);
 
imagefilledrectangle($im,$x,$y,0,0,$col);


imagejpeg($im);

/**End**/
?>



All times are GMT. The time now is 02:33 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0