nanaki
nanaki

Reputation: 117

Create dynamic html page with php

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.

Upvotes: 0

Views: 1544

Answers (1)

Andre
Andre

Reputation: 788

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);

Upvotes: 1

Related Questions