示例#1
0
<?php

if (isset($_POST['code'])) {
    require_once "Repositories/CR_File.php";
    require_once "Compiler/CCompiler.php";
    $codeFilePath = "public/output/reviewCode.c";
    $file = new CR_File($codeFilePath);
    $file->write($_POST['code']);
    $compiler = new CCompiler($file);
    $output = $compiler->compile();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
  <title>CodeRead</title>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <link href="public/assets/css/bootstrap.min.css" rel="stylesheet">
  <link href="public/assets/css/bootstrap-theme.min.css" rel="stylesheet">
  <style type="text/css">
    .starter-template {
      padding: 40px 15px;
      text-align: center;
    }
    body {
      padding-top: 70px;
      padding-bottom: 30px;
    }
示例#2
-1
 public function recognizeText($imageFile)
 {
     require_once "TesseractOCR/TesseractOCR.php";
     require_once "Repositories/CR_File.php";
     // Recognize text from image
     $tesseract = new TesseractOCR($imageFile->filePath);
     $tesseract->setWhitelist(range('A', 'Z'), range('a', 'z'), range(0, 9), '_-.,;"#<>()%{}[]= ');
     $txt = $tesseract->recognize();
     // Save text file
     // public/output/code_filename.ext
     $codeFilePath = "public/output/code_" . $imageFile->fileName . $this->LANGUAGES[$this->language];
     $recognizedCodeFile = new CR_File($codeFilePath);
     $recognizedCodeFile->write($txt);
     return $recognizedCodeFile;
 }