Advertisement
Advertisement
| 07.08.2008 at 10:36PM PDT, ID: 23549153 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: |
/**
*
*/
function createPreview($_file, $_noise_image) {
// create handle for new PDF document
$pdf_handler = pdf_new();
// open a file
pdf_open_file($pdf_handler, dirname($_file) . "/" . "preview_" . basename($_file));
// insert the previews
$images = new Imagick($_file);
//
foreach ($images as $k => $image) {
/****************************************
* THE NOISE
***************************************/
// Get original size of image
$height = $image->getImageHeight();
$width = $image->getImageWidth();
// We need an overlay ~66% of the image
$o_height = floor(2*($height) / 3);
// Grab region of the image and make into a new Imagick class
$im_overlay = $image->getImageRegion($width, $o_height, 0, $height - $o_height);
// Do obfuscating effect.
$im_overlay->blurImage(5,6);
//$im_overlay->addNoiseImage(imagick::NOISE_LAPLACIAN);
// Overlay images
$image->compositeImage($im_overlay, imagick::COMPOSITE_OVER, 0, $height - $o_height);
// Comment : I almost forgot the text overlay. Just add this after:
// image->compositeImage($im_overlay, imagick::COMPOSITE_OVER, 0, $height - $o_height);
/****************************************
* THE PREVIEW TEXT
*************************************/
// Do preview text
$draw = new ImagickDraw();
// Set font soze
$draw->setFontSize(52);
// Align text to center
$draw->setTextAlignment(imagick::ALIGN_CENTER);
// Initialize color class
$black = new ImagickPixel();
$black->setColor('black');
// Set text color
$draw->setFillColor($black);
// Draw text in middle of image (within 66%)
$draw->annotation(floor($width / 2), floor($height / 2), 'PREVIEW');
// Overlay text
$image->drawImage($draw);
/******************************
* CREATE THE IMAGE
****************************/
// Write out image, go on.
$preview_jpeg = dirname($_file) . "/" . "tmp_page" . $k . '_.jpg';
$image->setImageFormat("jpg");
$image->writeImage($preview_jpeg);
// start a new page (A4)
pdf_begin_page($pdf_handler, 595, 842);
$pdfimage = pdf_load_image($pdf_handler, "jpeg", $preview_jpeg, "");
pdf_place_image($pdf_handler, $pdfimage, 0, 0, 1);
// end page (A4)
pdf_end_page($pdf_handler);
// clean
@unlink($preview_jpeg);
//$image->clear();
//$image->destroy();
}
// close and save file
pdf_close($pdf_handler);
}
|