0

What I want to do is this:

  1. Create an .html or .php page
  2. Write HTML code and creating an element that looks like an Identity card. Writing CSS in same file in style tags.
  3. Writing some JS in script tags to alter some properties of HTML code.
  4. Using html2canvas library to convert that Identity card in a photo and store the image (By converting the canvas to image) in database using appropiriate JS functions.

  5. In a separate main file, calling ajax function to execute .html or .php page I have created above.

Is it possible? I want to do this so that users can't see this process. They would see only image that I've stored in database, that I would fetch later.

NOTE: I can do this process on same page without any problem. But I want to do it in a separate page using ajax.

Vikas
  • 720
  • 1
  • 9
  • 30
  • `I can do this process on same page without any problem. But I want to do it in a separate page using ajax` - shouldn't be too difficult to change your code that works to do so in a separate page – Jaromanda X Jan 15 '17 at 07:47
  • having no sense of your code, I can't possible answer how you could change it. It's possible that the code can't be changed, my comment said "it shouldn't be too difficult", an assumption on my part, but no code, so no idea. – Jaromanda X Jan 15 '17 at 08:17
  • Please see my this question. You may understand what I want. http://stackoverflow.com/questions/41658019/how-does-facebook-fun-apps-create-images-from-information-fetched/41659026#41659026 – Vikas Jan 15 '17 at 10:19

1 Answers1

0

basically, you want to edit in pic means "add photo into identity card", Am i right? If so--To do that use this code--

<?php
$dest = imagecreatefrompng('pic.png');
$src = imagecreatefromjpeg('card.jpg');
imagealphablending($dest, false);
imagesavealpha($dest, true);
imagecopymerge($dest, $src, 10, 9, 0, 0, 181, 180, 100); //adjust dimensions    
according to you
header('Content-Type: image/png');
imagepng($dest);
imagedestroy($dest);
imagedestroy($src);
?>

save file into your system then fetch that file into another page on which you want to display.

Mohammad Sadiqur Rahman
  • 5,379
  • 7
  • 31
  • 45
gourav bajaj
  • 170
  • 10
  • if you want to do that on separate page then why are you using ajax ?? ajax is for getting result from server without reloading the page ... on different page you cant do this with ajax u need to pass parameters into header and code in that page. – gourav bajaj Jan 15 '17 at 08:00