Remove link for full size and add link for full size and thumb. Few ajust style.
This commit is contained in:
parent
73f5564569
commit
7490983bb0
3 changed files with 44 additions and 23 deletions
|
@ -49,7 +49,7 @@ then
|
||||||
fi
|
fi
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
if [ $onlyThumb ]
|
if [ $onlyThumb == 1 ]
|
||||||
then
|
then
|
||||||
convert "cache/tmp/$md5Site.png" -crop 1280x1024+0+0 -filter Lanczos -thumbnail "$thumbSize" "cache/img/$md5Site""_thumb.png"
|
convert "cache/tmp/$md5Site.png" -crop 1280x1024+0+0 -filter Lanczos -thumbnail "$thumbSize" "cache/img/$md5Site""_thumb.png"
|
||||||
if [ $optimizeTool ]
|
if [ $optimizeTool ]
|
||||||
|
@ -57,7 +57,7 @@ then
|
||||||
eval $optimizeTool "cache/img/$md5Site""_thumb.png"
|
eval $optimizeTool "cache/img/$md5Site""_thumb.png"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
convert "cache/tmp/$md5Site.png" -crop 1280x1024+0+0 "cache/img/$md5Site.png" &&
|
convert "cache/tmp/$md5Site.png" -crop 1280x1024+0+0 "cache/img/$md5Site.png"
|
||||||
convert "cache/img/$md5Site.png" -filter Lanczos -thumbnail "$thumbSize" "cache/img/$md5Site""_thumb.png"
|
convert "cache/img/$md5Site.png" -filter Lanczos -thumbnail "$thumbSize" "cache/img/$md5Site""_thumb.png"
|
||||||
if [ $optimizeTool ]
|
if [ $optimizeTool ]
|
||||||
then
|
then
|
||||||
|
|
|
@ -6,7 +6,7 @@ html {
|
||||||
background-color: #dedede;
|
background-color: #dedede;
|
||||||
}
|
}
|
||||||
|
|
||||||
form {
|
form, #result{
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
width: 50%;
|
width: 50%;
|
||||||
|
@ -20,12 +20,20 @@ input, select {
|
||||||
height: 2em;
|
height: 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#result input[type=text] {
|
||||||
|
width: 80%;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
input[type=url] {
|
input[type=url] {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
label {
|
#result label {
|
||||||
margin-right: 1em;
|
margin-right: 1em;
|
||||||
|
width : 15%;
|
||||||
|
display: inline-block;
|
||||||
|
text-align:center;
|
||||||
}
|
}
|
||||||
|
|
||||||
form .info {
|
form .info {
|
||||||
|
@ -38,6 +46,7 @@ form .info {
|
||||||
#result {
|
#result {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
|
margin: 1em auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
#result img {
|
#result img {
|
||||||
|
@ -52,7 +61,7 @@ form .info {
|
||||||
padding: 0.1em;
|
padding: 0.1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
form {
|
form, #result {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 0.1em;
|
padding: 0.1em;
|
||||||
}
|
}
|
||||||
|
@ -69,6 +78,7 @@ form .info {
|
||||||
label {
|
label {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
width: 99%;
|
width: 99%;
|
||||||
height: 2em;
|
height: 2em;
|
||||||
|
|
35
index.php
35
index.php
|
@ -16,7 +16,7 @@ $GLOBALS['config']['defaultUrl'] = 'https://google.com';
|
||||||
// default url for form
|
// default url for form
|
||||||
$GLOBALS['config']['defaultThumbSize'] = '120x90';
|
$GLOBALS['config']['defaultThumbSize'] = '120x90';
|
||||||
// default size for thumbnail
|
// default size for thumbnail
|
||||||
$GLOBALS['config']['onlyThumb'] = true;
|
$GLOBALS['config']['onlyThumb'] = TRUE;
|
||||||
// generate only thumbnail or generate thumbnail + 1280x1024 image
|
// generate only thumbnail or generate thumbnail + 1280x1024 image
|
||||||
$GLOBALS['config']['thumbSize'] = array(1 => '100x80', '120x90', '200x160', '300x240', '400x320', '500x400');
|
$GLOBALS['config']['thumbSize'] = array(1 => '100x80', '120x90', '200x160', '300x240', '400x320', '500x400');
|
||||||
// list of available size for thumb
|
// list of available size for thumb
|
||||||
|
@ -69,14 +69,20 @@ function testExistImg($file) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function launchScript($url, $md5Url, $width, $waitForResult = false) {
|
function launchScript($url, $md5Url, $width, $onlyThumb, $waitForResult = false) {
|
||||||
$md5Url = escapeshellarg($md5Url);
|
$md5Url = escapeshellarg($md5Url);
|
||||||
$url = escapeshellarg($url);
|
$url = escapeshellarg($url);
|
||||||
$width = escapeshellarg($width);
|
$width = escapeshellarg($width);
|
||||||
if ($waitForResult === false) {
|
if ($GLOBALS['config']['onlyThumb'] === true) {
|
||||||
exec('bin/thumb_server.sh ' . $url . ' ' . $md5Url . ' ' . $width . ' ' . (bool)$GLOBALS['config']['onlyThumb'] . ' > /dev/null &', $result);
|
$onlyThumb = 1;
|
||||||
} else {
|
} else {
|
||||||
exec('bin/thumb_server.sh ' . $url . ' ' . $md5Url . ' ' . $width . ' ' . (bool)$GLOBALS['config']['onlyThumb'] . ' 1', $result);
|
$onlyThumb = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($waitForResult === false) {
|
||||||
|
exec('bin/thumb_server.sh ' . $url . ' ' . $md5Url . ' ' . $width . ' ' . $onlyThumb . ' > /dev/null &', $result);
|
||||||
|
} else {
|
||||||
|
exec('bin/thumb_server.sh ' . $url . ' ' . $md5Url . ' ' . $width . ' ' . $onlyThumb . ' 1', $result);
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
@ -267,7 +273,7 @@ if ($_POST) {
|
||||||
$file = 'cache/img/' . $md5Url;
|
$file = 'cache/img/' . $md5Url;
|
||||||
|
|
||||||
if (testExistImg($file) !== true || isset($ui['fr']) && (int)$ui['fr'] === 1) {
|
if (testExistImg($file) !== true || isset($ui['fr']) && (int)$ui['fr'] === 1) {
|
||||||
launchScript($defUrl, $md5Url, $width, true);
|
launchScript($defUrl, $md5Url, $width, $GLOBALS['config']['onlyThumb'], true);
|
||||||
}
|
}
|
||||||
$success = array('normal' => $file . '.png', 'thumb' => $file . '_thumb.png');
|
$success = array('normal' => $file . '.png', 'thumb' => $file . '_thumb.png');
|
||||||
}
|
}
|
||||||
|
@ -275,6 +281,9 @@ if ($_POST) {
|
||||||
if (empty($defUrl)) {
|
if (empty($defUrl)) {
|
||||||
$defUrl = $GLOBALS['config']['defaultUrl'];
|
$defUrl = $GLOBALS['config']['defaultUrl'];
|
||||||
}
|
}
|
||||||
|
if (empty($width)) {
|
||||||
|
$width = $GLOBALS['config']['defaultThumbSize'];
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
|
@ -294,7 +303,7 @@ if (empty($defUrl)) {
|
||||||
<select name="s">
|
<select name="s">
|
||||||
<?php
|
<?php
|
||||||
foreach ($GLOBALS['config']['thumbSize'] as $key => $value) {
|
foreach ($GLOBALS['config']['thumbSize'] as $key => $value) {
|
||||||
if ($value === $GLOBALS['config']['defaultThumbSize']) {
|
if ($value === $width) {
|
||||||
echo '<option value="', $key, '" selected="selected">', $value, '</option>';
|
echo '<option value="', $key, '" selected="selected">', $value, '</option>';
|
||||||
} else {
|
} else {
|
||||||
echo '<option value="', $key, '">', $value, '</option>';
|
echo '<option value="', $key, '">', $value, '</option>';
|
||||||
|
@ -302,6 +311,8 @@ if (empty($defUrl)) {
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
<label>Force refresh</label>
|
<label>Force refresh</label>
|
||||||
<input type="checkbox" value="1" name="fr" />
|
<input type="checkbox" value="1" name="fr" />
|
||||||
</p>
|
</p>
|
||||||
|
@ -313,16 +324,16 @@ if (empty($defUrl)) {
|
||||||
<a href="http://forge.leslibres.org/projects/soshot">Homepage</a>
|
<a href="http://forge.leslibres.org/projects/soshot">Homepage</a>
|
||||||
</p>
|
</p>
|
||||||
</form>
|
</form>
|
||||||
<div id="result">
|
|
||||||
<?php
|
<?php
|
||||||
if (!empty($success)) {
|
if (!empty($success)) {
|
||||||
if ($GLOBALS['config']['onlyThumb'] === true) {
|
echo '<div id="result">';
|
||||||
echo '<img src="', $success['thumb'], '?r=', time(), '"/>';
|
echo '<img src="', $success['thumb'], '?r=', time(), '"/>';
|
||||||
} else {
|
echo '<p><label>', $width, '</label><input type="text" value="http://', $_SERVER['SERVER_NAME'], '/', $success['thumb'], '" onclick="this.select()"/></p>';
|
||||||
echo '<a href="', $success['normal'], '"><img src="', $success['thumb'], '?r=', time(), '"/></a>';
|
if ($GLOBALS['config']['onlyThumb'] === false) {
|
||||||
|
echo '<p><label>1280x1024</label><input type="text" value="http://', $_SERVER['SERVER_NAME'], '/', $success['normal'], '" onclick="this.select()"/></p>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
echo '</div>';
|
||||||
?>
|
?>
|
||||||
</div>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in a new issue