Skip to content

Commit

Permalink
Fixed #44
Browse files Browse the repository at this point in the history
  • Loading branch information
MASNathan committed Mar 28, 2016
1 parent 2d9eb1a commit 36163a0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
6 changes: 4 additions & 2 deletions .gitignore
@@ -1,2 +1,4 @@
cache
jobs
cache/
jobs/
vendor/
.idea/
16 changes: 6 additions & 10 deletions shot.php
Expand Up @@ -12,16 +12,10 @@
}

if (!stristr($url, 'http://') and !stristr($url, 'https://')) {
$url = 'http://' . $url;
$url = 'http://' . $url;

}

$url_segs = parse_url($url);
if (!isset($url_segs['host'])) {
exit();
}


$here = dirname(__FILE__) . DIRECTORY_SEPARATOR;
$bin_files = $here . 'bin' . DIRECTORY_SEPARATOR;
$jobs = $here . 'jobs' . DIRECTORY_SEPARATOR;
Expand Down Expand Up @@ -70,11 +64,14 @@
$url = str_replace('<?', '', $url);
$url = str_replace('\077', ' ', $url);

$url_segs = parse_url($url);
if (!isset($url_segs['host'])) {
exit();
}

$screen_file = $url_segs['host'] . crc32($url) . '_' . $w . '_' . $h . '.jpg';
$cache_job = $cache . $screen_file;


$refresh = false;
if (is_file($cache_job)) {
$filemtime = @filemtime($cache_job); // returns FALSE if file does not exist
Expand All @@ -83,7 +80,6 @@
}
}


$url = escapeshellcmd($url);

if (!is_file($cache_job) or $refresh == true) {
Expand Down Expand Up @@ -127,7 +123,7 @@
if (is_file($cache_job)) {
if ($download != false) {
$file = $cache_job;
$file_name=basename($file);
$file_name = basename($file);
$type = 'image/jpeg';
header("Content-disposition: attachment; filename={$file_name}");
header("Content-type: {$type}");
Expand Down

0 comments on commit 36163a0

Please sign in to comment.