Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function SiteScreenshot($url/*, $size='200'*/, $format='png') {
- $Filename = md5($url/*.$size.$resolution*/).'.'.$format;
- // Директория где лежат скрины
- $ScreenshotDirectory = "i/";
- // Проверяем если есть такой файл в папке скринов
- if(@is_file($ScreenshotDirectory.$Filename)) {
- return $ScreenshotDirectory.$Filename;
- }
- else {
- $Image = @file_get_contents("http://mini.s-shot.ru/".$format."/?http://".$url);
- $OpenFile = fopen($ScreenshotDirectory.$Filename, "w+");
- // Сохраняем изображение
- $Write = fwrite($OpenFile, $Image);
- return $ScreenshotDirectory.$Filename;
- }
- }
- ?>
- <form action="" method="post">
- <input type="text" name="url" value="" />
- <input type="submit" name="b" value="screen" />
- </form>
- <?php if(isset($_POST['url'])) { echo "<img src='".SiteScreenshot($_POST['url'])."'>"; } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement