Archive for February, 2012

HTML Webpage to Image – OS Independent


  1. Place the below code in a PHP/HTML file, we will get the thumb image of the given Website
<img src=”; border=”0″>
  1. The values for size can be: t / s / m / l / x
Categories: PHP

HTML Webpage to Image On Windows – OS Dependent


  • It works only with Windows OS –  OS Dependent


  1. Download and install webthumb-activex-setup.exe from
  2. Then paste the below code and save as imageGrap.php


// Set the save folder


  // This sample saves the snapshot to the folder on the work dir of this script.

  // Please make sure the script has the WRITE permission in this folder.

  // You can also set the value to other folder, for example:

  //   $t_strSaveFolder = “c:/temp”;

  $t_strSaveFolder = dirname(__FILE__);

  // Set the image filename

  $t_strLargeImage = $t_strSaveFolder.”/main-thumb.large.png”;

  $t_strSmallImage = $t_strSaveFolder.”/main-thumb.small.png”;

  // Create instance ACAWebThumb.ThumbMaker.

  $t_xMaker = new COM(“ACAWebThumb.ThumbMaker”)

    or die(“Start ACAWebThumb.Maker failed”);

  // Set the URL and start snap

  $t_strURL = ‘;; // Site URL


  $t_iRet = $t_xMaker->StartSnap();

  if ( 0 == $t_iRet )


    // snap successful, save webpage to image with full size.

    $t_bRet1 = $t_xMaker->SaveImage($t_strLargeImage);

    // save webpage to thumbnail with 320×240 size

    $t_xMaker->SetThumbSize (320, 240, 0);

    $t_bRet2 = $t_xMaker->SaveImage($t_strSmallImage);

    // show the image online.

    if ( $t_bRet1 && $t_bRet2)


      echo “The snapshot from <a href='”.$t_strURL.”‘ target=_blank>”.$t_strURL.”</a>:”;

      echo “<a href=’main-thumb.large.png’>img src=’main-thumb.small.png’ border=1></a>”;




      echo “ERROR: Can’t save the snapshot to folder “.dirname(__FILE__).”. “;

      echo “Please make sure the script has the WRITE PERMISSION in this folder.”;




    echo “ERROR: Snap from “.$t_strURL.” failed. “;


3. Run the file, we will get the Webpage as image on the same folder.

Categories: PHP

Twitter Sign-in & Tweet with Drupal 7.10

  1. Download the module from
  2. We also need Oauth module, so get it from
  3. Unpack the modules and place it in the sites/all/modules folder
  4. Enable OAuth & Twitter in the admin/modules

5. Goto Twitter configuration page,

6. Click register your application link, will take us to the page. We need to add our website URL link to Twitter applications. Note: Developer site link –
7. Login with twitter account credentials, mouse over on the name(Right-Top Corner). Click “My Applications”. Click “Create a new application” and we will get the below form,

8. Fill the form:

Name –The name which the user decides

Description – About website

Website – Provide the website URL/ we can give our development server IP based URL

Application Type (Mandatory) – Select  Read and Write

Callback URL (Mandatory) – The URL given in Website & add /twitter/oauth as suffix

Save and Update the configuration details.

9. We will get now the OAuth token values,

10. Enter the Consumer Key in OAuth Consumer key & Consumer Secret in OAuth Consumer secret in and click Save Configuration
If each and every Article/ Page has to be posted into Twitter Select the Node Types in the POST tab.
If required default format of submitting the text into Twitter can be changed

Change the basic settings of Twitter SIGN-IN if required.

14. Then Save Configuration.

15. Select the Content type selected in Step:12

16. Add the content and we have an option to post it to Twitter. Select the checkbox.

17. Click Save. Now the content is tweeted in Twitter.

Categories: Drupal