middleware('auth:sanctum') // ->only(['show']); } /** * Display the specified resource. * * @param Request $request The log request. * @param string $name The log name. * @return \Illuminate\Http\Response */ public function show(Request $request, string $name) { // if ($request->user()?->hasPermission('logs/' . $name) === true) { $url = $request->get('url'); if ($url !== null) { $tmpfname = tempnam(sys_get_temp_dir(), 'download'); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $data = curl_exec($ch); curl_close($ch); file_put_contents($tmpfname, $data); $ocr = new TesseractOCR(); $ocr->image($tmpfname); $result = $ocr->run(500); unlink($tmpfname); return $this->respondJson([ 'ocr' => $result ]); }//end if return $this->respondWithErrors(['url' => 'url is missing']); } // $ffmpeg = FFMpeg\FFMpeg::create(); // // Load the input video // $inputFile = $ffmpeg->open('input.mp4'); // // Split the video into individual frames // $videoFrames = $inputFile->frames(); // foreach ($videoFrames as $frame) { // // Save the frame as a PNG // $frame->save(new FFMpeg\Format\Video\PNG(), 'frame-' . $frame->getMetadata('pts') . '.png'); // // Pass the PNG to Tesseract for processing // exec("tesseract frame-" . $frame->getMetadata('pts') . ".png output"); // } // // Read the output from Tesseract // $text = file_get_contents("output.txt"); // // Do something with the text from Tesseract // echo $text; }