|
|
 |
 |
 |
|
MergeImage |
MergeImage (
string |
$field |
string |
$merge |
string |
$align |
string |
$valign |
array |
$transparantColor = null |
) |
Arguments:
Name |
Description |
$field |
The name of the uploadfield where the image is uploaded in. |
$merge |
The image which should be used for merging. |
$align |
The horizontal alignment of the merge image. Possible values are:
"left"
"center" or "middle"
"right"
Or a percentage between 0 and 100, where '0%' is left and '100%' is right. |
$valign |
The vertal alignment where the merge image will be located on the original. Possible values are:
"top"
"middle" or "center"
"bottom"
Or you can give a percentage from 0 to 100, where "0%" is top and 100% is "bottom". |
$transparantColor |
The red, green and blue values of a color which should be transparant on the merge image. This only works on PNG24 files! |
Description:
Please note that merging an image with transparancy only works with some png images. See this topic for more information.
Example
<?php
// include the class
include("FH3/class.FormHandler.php");
// create a new formHandler object
$form = new FormHandler("myForm");
// the upload config
$uploadCfg = array(
"type" => "jpg jpeg png",
"name" => "", // <-- keep the original name
"exists" => "rename",
"path" => "images/uploads"
);
// uploadfield
$form->uploadField("Image", "image", $uploadCfg );
// merge the image with the stamp
// and make all black in the stamp transparant
$form->mergeImage("image", "images/stamp.png", "right", "bottom", array(0,0,0) );
// submit button to submit the form
$form->submitButton();
// set the onCorrect handler
$form->oncorrect("doRun");
// flush the form
$form->flush();
// the oncorrect handler
function dorun( $data )
{
// display the uploaded image
echo "<img src='images/uploads/". $data['image']."' alt='' />";
}
?>
|
Preview image

See also: UploadField | ResizeImage
Latest change: 05 March 10 / 08:57
Comments
|
|
|
|