3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<? // 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. "; ?>
based on iesNl
Output for 7.0.0 - 7.2.6
Fatal error: Uncaught Error: Class 'COM' not found in /in/1hjrr:15 Stack trace: #0 {main} thrown in /in/1hjrr on line 15
Process exited with code 255.
Output for 5.4.0 - 5.6.28
Fatal error: Class 'COM' not found in /in/1hjrr on line 15
Process exited with code 255.
Output for 4.3.0 - 5.3.29
<? // 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. "; ?>