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.

1 Answer 1

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);
Sign up to request clarification or add additional context in comments.

1 Comment

Cool, and no problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.