forked from leftypol/leftypol
Compare commits
15 commits
embedding-
...
config
Author | SHA1 | Date | |
---|---|---|---|
92fc2daa9c | |||
d224c0af23 | |||
c1c20bdab2 | |||
42e850091a | |||
87029580b6 | |||
cf74272806 | |||
336c40b0f7 | |||
81c02be563 | |||
fa56876c36 | |||
8da10af101 | |||
9431536112 | |||
025f1c4221 | |||
501e696891 | |||
557e43e38f | |||
6ee8670401 |
8 changed files with 20 additions and 59 deletions
|
@ -943,10 +943,6 @@
|
|||
// Location of thumbnail to use for deleted images.
|
||||
$config['image_deleted'] = 'static/deleted.png';
|
||||
|
||||
// When a thumbnailed image is going to be the same (in dimension), just copy the entire file and use
|
||||
// that as a thumbnail instead of resizing/redrawing.
|
||||
$config['minimum_copy_resize'] = false;
|
||||
|
||||
// Maximum image upload size in bytes.
|
||||
$config['max_filesize'] = 10 * 1024 * 1024; // 10MB
|
||||
// Maximum image dimensions.
|
||||
|
@ -985,15 +981,6 @@
|
|||
// Set this to true if you're using Linux and you can execute `md5sum` binary.
|
||||
$config['gnu_md5'] = false;
|
||||
|
||||
// Use Tesseract OCR to retrieve text from images, so you can use it as a spamfilter.
|
||||
$config['tesseract_ocr'] = false;
|
||||
|
||||
// Tesseract parameters
|
||||
$config['tesseract_params'] = '';
|
||||
|
||||
// Tesseract preprocess command
|
||||
$config['tesseract_preprocess_command'] = 'convert -monochrome %s -';
|
||||
|
||||
// Number of posts in a "View Last X Posts" page
|
||||
$config['noko50_count'] = 50;
|
||||
// Number of posts a thread needs before it gets a "View Last X Posts" page.
|
||||
|
|
|
@ -104,8 +104,10 @@ function buildMenu(e) {
|
|||
|
||||
function addButton(post) {
|
||||
var $ele = $(post);
|
||||
// Use unicode code with ascii variant selector
|
||||
// https://stackoverflow.com/questions/37906969/how-to-prevent-ios-from-converting-ascii-into-emoji
|
||||
$ele.find('input.delete').after(
|
||||
$('<a>', {href: '#', class: 'post-btn', title: 'Post menu'}).text('►')
|
||||
$('<a>', {href: '#', class: 'post-btn', title: 'Post menu'}).text('\u{25B6}\u{fe0e}')
|
||||
);
|
||||
}
|
||||
|
||||
|
|
38
post.php
38
post.php
|
@ -1402,13 +1402,13 @@ function handle_post(Context $ctx)
|
|||
$file['thumbwidth'] = $size[0];
|
||||
$file['thumbheight'] = $size[1];
|
||||
} elseif (
|
||||
$config['minimum_copy_resize'] &&
|
||||
(($config['strip_exif'] && isset($file['exif_stripped']) && $file['exif_stripped']) || !$config['strip_exif']) &&
|
||||
$image->size->width <= $config['thumb_width'] &&
|
||||
$image->size->height <= $config['thumb_height'] &&
|
||||
$file['extension'] == ($config['thumb_ext'] ? $config['thumb_ext'] : $file['extension'])
|
||||
) {
|
||||
// Copy, because there's nothing to resize
|
||||
coopy($file['tmp_name'], $file['thumb']);
|
||||
copy($file['tmp_name'], $file['thumb']);
|
||||
|
||||
$file['thumbwidth'] = $image->size->width;
|
||||
$file['thumbheight'] = $image->size->height;
|
||||
|
@ -1551,35 +1551,6 @@ function handle_post(Context $ctx)
|
|||
}
|
||||
}
|
||||
|
||||
if ($config['tesseract_ocr'] && $file['thumb'] != 'file') {
|
||||
// Let's OCR it!
|
||||
$fname = $file['tmp_name'];
|
||||
|
||||
if ($file['height'] > 500 || $file['width'] > 500) {
|
||||
$fname = $file['thumb'];
|
||||
}
|
||||
|
||||
if ($fname == 'spoiler') {
|
||||
// We don't have that much CPU time, do we?
|
||||
} else {
|
||||
$tmpname = __DIR__ . "/tmp/tesseract/" . rand(0, 10000000);
|
||||
|
||||
// Preprocess command is an ImageMagick b/w quantization
|
||||
$error = shell_exec_error(sprintf($config['tesseract_preprocess_command'], escapeshellarg($fname)) . " | " .
|
||||
'tesseract stdin ' . escapeshellarg($tmpname) . ' ' . $config['tesseract_params']);
|
||||
$tmpname .= ".txt";
|
||||
|
||||
$value = @file_get_contents($tmpname);
|
||||
@unlink($tmpname);
|
||||
|
||||
if ($value && trim($value)) {
|
||||
// This one has an effect, that the body is appended to a post body. So you can write a correct
|
||||
// spamfilter.
|
||||
$post['body_nomarkup'] .= "<tinyboard ocr image $key>" . htmlspecialchars($value) . "</tinyboard>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($dont_copy_file) || !$dont_copy_file) {
|
||||
if (isset($file['file_tmp'])) {
|
||||
if (!@rename($file['tmp_name'], $file['file'])) {
|
||||
|
@ -1627,11 +1598,6 @@ function handle_post(Context $ctx)
|
|||
}
|
||||
}
|
||||
|
||||
// Do filters again if OCRing
|
||||
if ($config['tesseract_ocr'] && !hasPermission($config['mod']['bypass_filters'], $board['uri']) && !$dropped_post) {
|
||||
do_filters($ctx, $post);
|
||||
}
|
||||
|
||||
if (!hasPermission($config['mod']['postunoriginal'], $board['uri']) && $config['robot_enable'] && checkRobot($post['body_nomarkup']) && !$dropped_post) {
|
||||
undoImage($post);
|
||||
if ($config['robot_mute']) {
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 26 KiB |
|
@ -380,6 +380,7 @@ form table tr td div.center {
|
|||
|
||||
.file {
|
||||
float: left;
|
||||
min-width: 100px;
|
||||
}
|
||||
|
||||
.file:not(.multifile) .post-image {
|
||||
|
@ -390,6 +391,10 @@ form table tr td div.center {
|
|||
float: none;
|
||||
}
|
||||
|
||||
.file.multifile {
|
||||
margin: 0 10px 0 0;
|
||||
}
|
||||
|
||||
.file.multifile > p {
|
||||
width: 0px;
|
||||
min-width: 100%;
|
||||
|
|
|
@ -96,6 +96,7 @@
|
|||
grid-column: 1;
|
||||
grid-row: 3;
|
||||
width: 100%;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.modlog {
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
.home-description {
|
||||
margin: 20px auto 0 auto;
|
||||
text-align: center;
|
||||
max-width: 700px;"
|
||||
max-width: 700px;
|
||||
}
|
||||
</style>
|
||||
{{ boardlist.top }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue