Skip to content

Commit

Permalink
Controllers: Convert: Only use pdfCount() when file is PDF
Browse files Browse the repository at this point in the history
Signed-off-by: Dicky Herlambang (花) <herlambangdicky5@gmail.com>
  • Loading branch information
Nicklas373 committed Nov 6, 2024
1 parent c68d247 commit 049bf2a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/Http/Controllers/Api/Core/convertController.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,11 @@ public function convert(Request $request) {
$fileSize = filesize($newFilePath);
$newFileSize = AppHelper::instance()->convert($fileSize, "MB");
$procUuid = AppHelper::Instance()->generateUniqueUuid(cnvModel::class, 'processId');
$pdf = new Pdf($newFilePath);
$pdfTotalPages = $pdf->pageCount();
$pdfNameWithExtension = pathinfo($currentFileName, PATHINFO_EXTENSION);
if ($pdfNameWithExtension == "pdf") {
$pdf = new Pdf($newFilePath);
$pdfTotalPages = $pdf->pageCount();
}
appLogModel::create([
'processId' => $procUuid,
'groupId' => $batchId,
Expand Down

0 comments on commit 049bf2a

Please sign in to comment.