0

I need to create new html pages with PHP. What I need is to get a new html page with a canvas inside.

At this moment I capture the canvas from another page with html2canvas.

I need this canvas to become the background of the new html page, or just a 100% width 100% height picture.

What I have with PHP is this, but I need to capture the picture or just the canvas on fly, and then make something like this:

<?php

    $file = file_get_contents("example.html");
    file_put_contents("example.html", $file);
?>

How can I do this? thanks.

Mi-Creativity
  • 9,554
  • 10
  • 38
  • 47
nanaki
  • 117
  • 1
  • 10

1 Answers1

1

From what I understand you're trying to take a screenshot of a page, then use that as the background of another new created page in PHP.

Take a look at this for taking screen shots: Website screenshots using PHP

Once you have your screenshot taken, just use something such as

$newpage = 'example.html';
$contents = file_get_contents($newpage);
$contents = "<html><style>background-image: '<?php echo //Your Saved Screenshot ?>'</style></html>";
file_put_contents($newpage, $contents);
Community
  • 1
  • 1
Andre
  • 778
  • 1
  • 5
  • 23