Archive

Archive for February, 2012

HTML Webpage to Image – OS Independent

STEPS:

  1. Place the below code in a PHP/HTML file, we will get the thumb image of the given Website
<img src=”http://pagepeeker.com/thumbs.php?size=m&url=http://www.xxxxxx.com/sales-updates&#8221; border=”0″>
  1. The values for size can be: t / s / m / l / x
Categories: PHP

HTML Webpage to Image On Windows – OS Dependent

Note:

  • It works only with Windows OS –  OS Dependent

Steps:

  1. Download and install webthumb-activex-setup.exe from http://www.acasystems.com/en/web-thumb-activex/download.htm
  2. Then paste the below code and save as imageGrap.php

<?php

// Set the save folder

  // [IMPORTANT NOTE]:

  // 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 = ‘http://www.sitename-xxxxx.com/&#8217;; // Site URL

  $t_xMaker->SetURL($t_strURL);

  $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>”;

    }

    else

    {

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

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

    }

  }

  else

    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 http://drupal.org/project/twitter
  2. We also need Oauth module, so get it from http://drupal.org/project/oauth
  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, http://10.21.1.14/drupal-7.10/admin/config/services/twitter

6. Click register your application link, will take us to the https://dev.twitter.com/apps/new page. We need to add our website URL link to Twitter applications. Note: Developer site link – https://dev.twitter.com/apps/
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 http://10.21.1.14/drupal-7.10/admin/config/services/twitter and click Save Configuration
11. 
If each and every Article/ Page has to be posted into Twitter Select the Node Types in the POST tab.
12.
If required default format of submitting the text into Twitter can be changed

13.
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