diff --git a/build/service/CalendarExtractor.php b/build/service/CalendarExtractor.php index ce83030..3476189 100644 --- a/build/service/CalendarExtractor.php +++ b/build/service/CalendarExtractor.php @@ -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 */ diff --git a/build/service/Tesseract.php b/build/service/Tesseract.php index be43add..0f1443f 100755 --- a/build/service/Tesseract.php +++ b/build/service/Tesseract.php @@ -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]}" ];