Modify php function to use the php imagick extension
- or -
Post a project like this2112
$$
- Posted:
- Proposals: 2
- Remote
- #2044866
- Awarded
Description
Experience Level: Intermediate
Estimated project duration: 1 day or less
I have a php script running on my website that takes the post data from a form (including the signature_pad signature capture) and places all of this on a PDF document.
I need to trim the whiteface from signature image sent using the php extension imagick before posting into the PDF document, without saving a hard copy of the signature to the server.
so currently it runs like this:
$ sig = the post data from signature_pad
$pic =getImage($sig);
//puts $pic in the PDF using FPDF
function getImage($dataURI) {
$img = explode(',',$dataURI,2);
$pic = 'data://text/plain;base64,'.$img[1];
$type = explode("/", explode(':', substr($dataURI, 0, strpos($dataURI, ';')))[1])[1]; // get the image type
if ($type=="png"||$type=="jpeg"||$type=="gif") return array($pic, $type);
return false;
}
I need to either modify the getImage() function or create a couple of new functions that trims the whitespace (empty space) around the signature and then resize to desired height or width with the same aspect ratio... and returns the image like the getImage() function above so it can still be placed on the PDF
so like this:
$pic = getImage($sig);
$pic = trim($pic);
$pic = resize($pic);
//puts $pic in the PDF using FPDF
I need to trim the whiteface from signature image sent using the php extension imagick before posting into the PDF document, without saving a hard copy of the signature to the server.
so currently it runs like this:
$ sig = the post data from signature_pad
$pic =getImage($sig);
//puts $pic in the PDF using FPDF
function getImage($dataURI) {
$img = explode(',',$dataURI,2);
$pic = 'data://text/plain;base64,'.$img[1];
$type = explode("/", explode(':', substr($dataURI, 0, strpos($dataURI, ';')))[1])[1]; // get the image type
if ($type=="png"||$type=="jpeg"||$type=="gif") return array($pic, $type);
return false;
}
I need to either modify the getImage() function or create a couple of new functions that trims the whitespace (empty space) around the signature and then resize to desired height or width with the same aspect ratio... and returns the image like the getImage() function above so it can still be placed on the PDF
so like this:
$pic = getImage($sig);
$pic = trim($pic);
$pic = resize($pic);
//puts $pic in the PDF using FPDF
Robert D.
100% (5)Projects Completed
5
Freelancers worked with
5
Projects awarded
43%
Last project
17 Nov 2022
United Kingdom
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
There are no clarification messages.
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies