Q695 Posted June 10, 2013 Share Posted June 10, 2013 How do I capture an image on the server side, if the user doesn't get to see the output of a page, until after it's completed (in a minute, or more)? Quote Link to comment Share on other sites More sharing options...
Adam Posted June 10, 2013 Share Posted June 10, 2013 Capture an image? Of the user's screen? You can't do that. Would you like it if a website could take screenshots of what you're seeing whenever it wanted? Quote Link to comment Share on other sites More sharing options...
davidannis Posted June 10, 2013 Share Posted June 10, 2013 I think that you want to capture the content of the output buffer http://php.net/manual/en/function.ob-get-contents.php Quote Link to comment Share on other sites More sharing options...
Q695 Posted June 10, 2013 Author Share Posted June 10, 2013 (edited) The output buffer is going to take a long time to process the content, because it's a 25X25 table with an image in each square. Â I am using a form submit that renders a map output behind the scenes, then displays it to the folder with other maping images. Â Capture an image? Of the user's screen? You can't do that. Would you like it if a website could take screenshots of what you're seeing whenever it wanted? It's a server side trigger for an image capture after everything being grabbed is displayed to the server. Edited June 10, 2013 by Q695 Quote Link to comment Share on other sites More sharing options...
Adam Posted June 11, 2013 Share Posted June 11, 2013 An output buffer would take a few milliseconds to process the mark-up for that number of images. It's only mark-up after all, unless you base64 encode the image data or something? Â The problem is that you're forcing the user to download 625 images all at once! You should lazy-load them. Define the div the correct width and height to contain them all, but only load the actual image when it's needed, or when it's say one or two images out of view. Otherwise you're going to waste a tonne of bandwidth and slow down the initial page load like crazy, if not crashing the browser. Â You'll need to use JS, but I suspect you'll be able to download a jQuery plug-in or something to handle it. Quote Link to comment Share on other sites More sharing options...
Adam Posted June 11, 2013 Share Posted June 11, 2013 It's a server side trigger for an image capture after everything being grabbed is displayed to the server. I don't really see what that has to do with a map? You can't trigger a screen grab from the server. Not unless the client has some special software installed and grants you permission. A standard website cannot do it though. Quote Link to comment Share on other sites More sharing options...
Q695 Posted June 11, 2013 Author Share Posted June 11, 2013 An output buffer would take a few milliseconds to process the mark-up for that number of images. It's only mark-up after all, unless you base64 encode the image data or something? Â The problem is that you're forcing the user to download 625 images all at once! You should lazy-load them. Define the div the correct width and height to contain them all, but only load the actual image when it's needed, or when it's say one or two images out of view. Otherwise you're going to waste a tonne of bandwidth and slow down the initial page load like crazy, if not crashing the browser. Â You'll need to use JS, but I suspect you'll be able to download a jQuery plug-in or something to handle it. Â Actually the 625 images would be image locations with 10 different images total being downloaded like an image pixel with 10 options that are about 20 px X 20 px grid. Quote Link to comment Share on other sites More sharing options...
Adam Posted June 11, 2013 Share Posted June 11, 2013 Not sure if its because I've just woken up, but I can't seem to make any sense from your last post? 625 images would be 10 images? Wha? Quote Link to comment Share on other sites More sharing options...
Q695 Posted June 11, 2013 Author Share Posted June 11, 2013 Not sure if its because I've just woken up, but I can't seem to make any sense from your last post? 625 images would be 10 images? Wha? think of a *.jpg that only has 10 colors in it being created by a table, and MySQL, then telling the server to take a snapshot of it for use somewhere else. Quote Link to comment Share on other sites More sharing options...
kicken Posted June 11, 2013 Share Posted June 11, 2013 think of a *.jpg that only has 10 colors in it being created by a table, and MySQL, then telling the server to take a snapshot of it for use somewhere else. That doesn't help me understand it at all. Â In any case, I still have no idea what it is you really want to do. Do you want to create an image of what the rendered page would look like in the browser? For that you'd either need a app that can render HTML to an image or you'd have to install a browser and some screen-capture software on the server to load the page and snap the picture. Â If that is not what you're trying to do you need to do a much better job of explaining yourself. Quote Link to comment Share on other sites More sharing options...
Q695 Posted June 11, 2013 Author Share Posted June 11, 2013 (edited) Do you want to create an image of what the rendered page would look like in the browser? For that you'd either need a app that can render HTML to an image or you'd have to install a browser and some screen-capture software on the server to load the page and snap the picture. Exactly, but like a button press cronjob. I have a page that is written just to do the image output in HTML, but now I want to have it converted to an image. Edited June 11, 2013 by Q695 Quote Link to comment Share on other sites More sharing options...
Barand Posted June 11, 2013 Share Posted June 11, 2013 You can use the GD library to copy a load of smaller images into a larger image and then save the large image. If that is what you mean? Quote Link to comment Share on other sites More sharing options...
Q695 Posted June 11, 2013 Author Share Posted June 11, 2013 (edited) You can use the GD library to copy a load of smaller images into a larger image and then save the large image. If that is what you mean? How? Â Is there an easy way to take it from HTML, and make it a PHP, if it's already in a table form (think of how overhead projectors used to be able to convert print on paper onto a clear film I want the clear film copies). Edited June 11, 2013 by Q695 Quote Link to comment Share on other sites More sharing options...
Barand Posted June 11, 2013 Share Posted June 11, 2013 If your printer can handle transparencies, can't you just print the page? Quote Link to comment Share on other sites More sharing options...
Q695 Posted June 11, 2013 Author Share Posted June 11, 2013 The images are like transparencies (not actually transparencies), but electronic images being put into a file. I to put the output in a file electronically, just have the user click a submit button that will make an image of the output.  This is what I have: <?php $filename = 'image.jpg'; header('Content-Disposition: inline; filename="'.$filename.'"'); header("Content-Type: image/png"); // Don't forget the Content-Type as well... // Output image here /* header("Content-Type: image/png"); header('Content-Disposition: inline; filename="some.png"'); //*/ ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <meta name="generator" content="Adobe GoLive" /> <title>Untitled Page</title> </head> <body> <?php $id='1'; $img_fldr='../'; if (isset($_GET['map']) && $_GET['map']!='' && isset($id) && $id!=''){ include "../connection.php";//the database connection off the main application include "../design.php";//the object I want to have a screen shot of behind the scenes } ?> </body> </html> The URL being pulled is: http://localhost/fall_axe/builder/map_render.php?map=1  error: it says there are errors, but when without the header info it works just fine. Quote Link to comment Share on other sites More sharing options...
Q695 Posted June 12, 2013 Author Share Posted June 12, 2013 I think I found what I'm looking for, and just need to make it work with the code being written by the server: http://www.webmasterworld.com/forum88/3910.htm Quote Link to comment Share on other sites More sharing options...
Q695 Posted June 12, 2013 Author Share Posted June 12, 2013 You guys were right, I was wrong, I should do: it with switches being flipped to certain colors behind the scenes, then store the flips as a formula in a single database entry with a longtext field storing the data, and strip the <a>. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.