- dirname: documentation ( source)
<?
// 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.acasystems.com';
$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 320x240 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. ";
?>