生成pdf

This commit is contained in:
2026-01-09 13:08:17 +08:00
parent 3d7da36645
commit 620ef3fe3a
7 changed files with 151 additions and 32 deletions
+18
View File
@@ -250,4 +250,22 @@ class UsedCarService
return null;
}
function downloadImage(string $url): string
{
$dir = runtime_path('pdf/images/');
if (!is_dir($dir)) {
mkdir($dir, 0755, true);
}
$filename = md5($url) . '.jpg';
$path = $dir . $filename;
if (!file_exists($path)) {
$img = file_get_contents($url);
file_put_contents($path, $img);
}
return $path;
}
}