Zubrag.com
July 22, 2018, 12:30:24 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1] 2
  Print  
Author Topic: Website thumbnail generator on Linux  (Read 82711 times)
zubrag
Administrator
Hero Member
*****
Posts: 787


WWW
« on: January 24, 2007, 08:08:54 AM »

A lot of requests for thumbnail generator on Linux. Posted some links to external resources here.

After some research/analysis was able to generate website screenshots on my Windows machine using Firefox. Think that should also work on Linux.

You'll need Firefox 2 browser installed on the server.

1. Download Pearl Crescent Page Saver. It is a Firefox screen capture extension. Free version is ok.

2. Install the extension in Firefox.
firefox -install-global-extension "/path/to/the/extension-file.xpi"

3. By default saved images would be named after page title. In order to name images after domain name or URL follow this step.
Go to Firefox extensions folder, and change chrome/pagesaver.jar => content\browserOverlay.js
Replace following code
  var pageTitle = (aWindow && aWindow.document) ? aWindow.document.title : null;
with this code to name images after domain name
  var pageTitle = (aWindow && aWindow.document) ? aWindow.document.domain.replace(/\./g,"_") : null;
OR with this code to name images after URL
  var pageTitle = (aWindow && aWindow.document) ? aWindow.document.location.href.replace(/\./g,"_") : null;

4. Now you should be able to save website screenshot by executing Firefox from the command line, like:
  firefox -savepng http://www.site-name-here.com/

It will open Firefox window, open URL, save image as PNG, and close Firefox.

Images captured using the -savepng command line flag are saved to Firefox's Download Folder. You can set this location from the Downloads section of the Firefox Options window.

Would appreciate comments since I had no chance to try it on Linux.

Logged
shaw
Newbie
*
Posts: 13


« Reply #1 on: February 07, 2007, 11:00:59 AM »

We may accommodate you by letting you to use one of our Linux boxes
running PHP 4.4.4 (full root access) if you use this opportunity to develop
PHP version of Website Thumb Generator for Linux.

Are you interested?
Logged
zubrag
Administrator
Hero Member
*****
Posts: 787


WWW
« Reply #2 on: February 07, 2007, 11:25:06 AM »

Thank you for so generous proposition!

I have not much *nix admin knowledge and cannot spend much time on this, but it would be interesting to try.
Yes, I'm interested.
Logged
shaw
Newbie
*
Posts: 13


« Reply #3 on: February 09, 2007, 12:07:48 AM »

Ok, get in touch with us using email address you have on your forum file
Logged
harakiro
Newbie
*
Posts: 3


« Reply #4 on: December 31, 1999, 05:26:31 PM »

So I installed this on my box and got it working via command line.

However, when I execute it via php it doesn't work.

To further investigate I tried to issue the command via a remote terminal and I get an error stating:
Gtk-WARNING **: cannot open display.

Has anyone had any luck getting this working?

Jesse
Logged
zubrag
Administrator
Hero Member
*****
Posts: 787


WWW
« Reply #5 on: March 27, 2007, 04:21:33 PM »

got it working via command line
Do you mean you were able to generate screenshot from command line?

How are you executing Firefox from php (syntax and php function you use for execution)?
Maybe php runs under another user, which does not have enough permissions?

I'm new to Linux, so cannot help you much. Maybe following would give you some ideas
1. prompt$ xhost + (from the connecting client)
2. export DISPLAY=client-ip-address:0.0
Logged
harakiro
Newbie
*
Posts: 3


« Reply #6 on: March 27, 2007, 08:37:55 PM »

If i login as a user on the box and open a terminal. I can generate a screenshot from the commandline.

However, If i log in from a remote machine via terminal with an account that has sufficient rights and run the script I the commandline I get the error stated above.

The key difference here is that in the first instance an Xserver or Xdesktop is running therefore it can open a window. In the latter because i've not started the "xwin" application I think the ability to open a window is failing.

From php i used the shell_exe command shell_exec(firefox -savepng http://www.site-name-here.com/);

I too am pretty green when it comes to linux and not sure what the two commands would achieve that you mentioned below =).

Thanks
Logged
zubrag
Administrator
Hero Member
*****
Posts: 787


WWW
« Reply #7 on: March 28, 2007, 04:49:06 PM »

Found article about saving thumbs from firefox using Xvfb
http://www.semicomplete.com/blog/geekery/xvfb-firefox.html

Does it help?
Logged
harakiro
Newbie
*
Posts: 3


« Reply #8 on: March 28, 2007, 06:38:05 PM »

Thanks!

Ill try this out tomorrow. I had found a differnt link that discribes this some and couldnt get it working but this explains a few steps differently.

will keep you posted.

Jesse
Logged
imike24
Newbie
*
Posts: 1


« Reply #9 on: February 04, 2008, 02:15:16 AM »

Thank. I will try it tonight. Thank for the article.
Logged
madison12
Newbie
*
Posts: 1


« Reply #10 on: June 08, 2010, 10:24:31 PM »

nice information. Thanks for sharing!!!
Logged
khnhdjs5
Newbie
*
Posts: 1


« Reply #11 on: October 27, 2011, 01:00:09 AM »

I think, itís a helpful topic. I like this topic. I want know some helpful things from this side. It fresh my mind and experience. So lots of thanks for sharing this information with me.



led flood lights
Logged
dannylucas88
Newbie
*
Posts: 1


« Reply #12 on: December 20, 2011, 08:39:35 PM »

So I installed this on my box and got it working via command line.

However, when I execute it via php it doesn't work.

To further investigate I tried to issue the command via a remote terminal and I get an error stating:
Gtk-WARNING **: cannot open display.

Has anyone had any luck getting this working?

Jesse

If you are still trying to get this to work, I would suggest checking out Enterprise Web Hosting and Web Hosting.  I was running into some similar issues and these were excellent resources that provided me a lot of information in setting up my Linux system. Hope this helps you out.
-Danny
Logged
berton32
Newbie
*
Posts: 1


« Reply #13 on: July 12, 2012, 09:46:23 PM »

Well this is what i want to move my site to Linux by using the PHP. I want to move the party dresses 2012 and Casual Dresses 2012 initially! then i want to move forward.
Logged
Pages: [1] 2
  Print  
 
Jump to:  

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC