I find I seem to write a few image modify programs and so I was going to create a function:
function resize( $width = 600, $height = 600, $background = 'White', $text = 'Watermark');
{
// Resize code
}
// Will give me a new image 600 wide 600 heigh on a white background watermarked with the text watermark.
resize( );
// Will give me a new image 800 wide 800 heigh on a gray background watermarked with the text Anthony.
resize( 800, 800, 'gray', 'Anthony');
If I want an image 600 wide 600 heigh on a gray background watermarked with the text watermark.
I can not do this as I will get an error:
resize( 'gray' );
So I will need to put values in for everything even though some of them are the same as the default values?
resize( 600, 600, 'gray', 'watermark');
It looks like it would be easier to define the variables and just use them in the function call and not have any defaults in the function?
Thinking about this if I wanted to create two different thumbnail sizes or similar I would need to set two lots of variables.
$width = 600;
$height = 600;
$background = 'gray';
$text = 'Watermark';
resize( $width, $height, $background, $text);
What is a good way to go about this?