optimized tesseract img*2.4

This commit is contained in:
xdrm-brackets 2017-09-16 18:38:56 +02:00
parent c5ae428db4
commit 08f93e18e6
2 changed files with 16 additions and 10 deletions

View File

@ -208,7 +208,7 @@
$read_location = is_null($ev['location']) ? '?' : $ev['location'];
$sqlr = DatabaseDriver::getPDO()->prepare("SELECT id_location FROM location WHERE basename = :bn AND id_event = :ide");
$sqlr = DatabaseDriver::getPDO()->prepare("SELECT id_location FROM location WHERE basename = :bn AND id_event = :ide AND basename <> '?'");
$sqlr->execute([ ':bn' => $read_location, ':ide' => $event_id ]);
$fetched = $sqlr->fetch();
@ -289,25 +289,31 @@
$link = __ROOT__."/tmp/$uid.jpeg";
$width = $stop[0]-$start[0];
$height = $stop[1]-$start[1];
$resize_factor = 2;
$resize = [
'x' => 2.5,
'y' => 2.4
];
$padx = 16;
$pady = 5;
/* [1] Get the right clip
=========================================================*/ {
/* (1) Create clipped copy */
$clip = \imagecreatetruecolor($width*$resize_factor, $height*$resize_factor);
$clip = \imagecreatetruecolor($width*$resize['x'], $height*$resize['y']);
$copied = \imagecopyresized(
$clip, // destin img
$this->img_res, // source img
0, // dest x
0, // dest y
$start[0], // src x
$start[1], // src y
$width*$resize_factor, // dest w
$height*$resize_factor, // dest h
$width, // src w
$height // src h
$start[0]+$padx, // src x
$start[1]+$pady, // src y
$width*$resize['x'], // dest w
$height*$resize['y'], // dest h
$width-2*$padx, // src w
$height-2*$pady // src h
);
/* (2) Manage copy error */

View File

@ -86,7 +86,7 @@
for( $i = 2 ; $i < count($lines) ; $i++ ){
// Amphi ... //
if( preg_match('@^a[nm](?:[bp][hln])?[ir] ?(.+)$@i', $lines[$i], $m) ) // 'amphi A', 'amphi 600 droit'
if( preg_match('@^a[nm](?:[bp][hln])?[irj] ?(.+)$@i', $lines[$i], $m) ) // 'amphi A', 'amphi 600 droit'
return [ 'name' => $title, 'location' => "Amphi ${m[1]}" ];