Solved

Save DIV to image file

Posted on 2013-11-27
5
2,039 Views
Last Modified: 2013-12-19
I have an Intranet app using PHP and jpGraph to generate a line chart on my page using data from a database used for tracking production rate versus production goal.

Above the chart, I have text displaying various color-coded metric values.  Below the chart I haev a running tally showing the number of end-of-line defects for the current run.  All of thjis is placed in a single DIV on my page.  There are other divs with other data, but the are not important.

What I am looking for is a way to capture the contents of the chart div (including all text) AS LAYED OUT ON THE SCREEN and save that to an image file on my network for use by other apps.

I essetially want to perform an automated "snipping tool" like Windows 7 has.

Is this possible at all?

Note: I am not using HTML5, so canvas is out as a solution....
0
Comment
Question by:dimmergeek
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 39681969
Why not use HTML5?  It's what everyone is using today!

But that aside, if you use Windows there are some "imagegrab" functions.
http://php.net/manual/en/function.imagegrabwindow.php

Also, you might be able to send the graph to the file system this way:
http://jpgraph.net/doc/faq.php#F2-1
0
 
LVL 7

Author Comment

by:dimmergeek
ID: 39682000
Ray, that looks promising, but it also appears to grab the contents of the entire window.  I just want a particular div.  Alternatively, is there a way I can grab the entire window and crop out the area I do not need?
0
 
LVL 12

Expert Comment

by:Cyber-spy
ID: 39682013
Are you trying to do this automatically with a script or manually?

If you want to automate it, here is a PowerShell script you can use to screenshot the entire screen or just a windows and save it to a file

http://gallery.technet.microsoft.com/scriptcenter/eeff544a-f690-4f6b-a586-11eea6fc5eb8
0
 
LVL 110

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 39682061
grab the entire window and crop out the area
Yes, there is this:
http://php.net/manual/en/function.imagecrop.php

If you're on a lower level of PHP, you have imageCopy() but there is some calculation you would need to do.  It's a project that kinds of works in reverse.  Normally PHP is used on the server to generate data (HTML, JS, CSS) that is sent to the client.  When you start trying to use PHP to get client data you're really swimming upstream and it's probably better to look for a different approach.
0
 
LVL 14

Expert Comment

by:jb1dev
ID: 39682203
You might also consider using PhantomJS to do this.
http://phantomjs.org/

https://github.com/ariya/phantomjs/wiki/Screen-Capture
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
The viewer will learn how to count occurrences of each item in an array.

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question