LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Some insight on whats going wrong [Not a coding problem, but concept problem] (https://www.linuxquestions.org/questions/linux-newbie-8/some-insight-on-whats-going-wrong-%5Bnot-a-coding-problem-but-concept-problem%5D-683260/)

imoracle 11-13-2008 05:35 PM

Some insight on whats going wrong [Not a coding problem, but concept problem]
 
Hello All,

Well being from non-CSE background does hamper me many times and here it is again.

I am simply trying to write a script, which will take screenshots of the websites gives as input parameter to it.

Well the algorithm is simple:
1. Open site on your browser
2. Take a screenshot
3. Save the screenshot

Now I tried this on my local Ubuntu (running using VMWare) and here is what i tried:

Code:

sleep 10; xwd -root | convert - screenshot.jpg
and it gives me a screenshot of the screen. (I open up my browse while it was in sleep for 10 seconds).

Now I wanted this to be reproduced on my VPS (Debian, text only with no monitor/screen). So i went and tried, xwd which was not installed on by default.

So I installed the xbase-clients package. But now when I try to run xwd, it says :

Code:

xwd:  unable to open display ''
Now I am unable to understand what's wrong. I typed

Code:

startx
and it hung my shell.

Can someone kindly guide me through this? Is it really not possible to do this on my VPS, which I was doing with ease on my Ubuntu box.

Regards,
Imoracle

johnson_steve 11-13-2008 05:45 PM

Quote:

Originally Posted by imoracle (Post 3341191)
I typed

Code:

startx

Prob didn't hang the shell. did it maybe start X in that shell (spit out a bunch of garbage and then apear unresponsive?) how do you plan on opening the web browser and going to another page when there is no monitor?

imoracle 11-13-2008 06:13 PM

yeah here is where the problem comes......I prepared script on my local ubuntu box and then tried to move to my VPS. But now I suddenly realize that i dont have a monitor to take a screenshot from.

I am not sure how can I achieve this or how do others achieve this.

Any pointers will be highly appreciated.

Imoracle

johnson_steve 11-13-2008 10:58 PM

Well I'd still like to help but I don't realy understand what your doing here. You are trying to take a screenshot of what a web page looks like on a headless computer. why?

imoracle 11-13-2008 11:41 PM

Actually I am making a service where people will submit there blog url's and I will show them to the world. But instead of simply showing the blog name, post title and post snippet I also want to have a snapshot of the post page.

Now problem is: User comes and submit his blog/site etc etc. How do I take snapshot of his submitted article. Hence I thought of the above steps to achieve this, which seemed to be working fine on my local ubuntu but not on my VPS (Debian).

I have only shell access to my VPS.

So this is the problem in short. Another problem is that I simply don't want to have the thumbnails by using some third party tool etc, in the process I also want to learn the methodology used by some sites to generate them.

Regards,
Imoracle

pinniped 11-13-2008 11:49 PM

A better alternative would be to fetch the contents with a 'wget' script. Now all you need to find is a tool to render the html to an image file like png.


All times are GMT -5. The time now is 10:25 AM.