Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

aitldev4's avatar

#Want to convert .dwg file format to .jpg image

How can I convert .dwg(autocad file) file format to .jpg/.jpeg image?? Is this possible using laravel??

as an example something like that(the way we can convert an image extension):-

if(request()->hasFile('dwg_file')) { $destinationPath = 'uploads/dwg/'; $image = $request->dwg_file; $file_extension = $image->extension(); if ($file_extension == 'dwg') { $file_extension = 'png'; } $filename = 'land_design_' . date('d-m-Y-G-i-s') . '.' . $file_extension; $image->move($destinationPath, $filename); }

0 likes
2 replies
bobbybouwmann's avatar

I don't think you can do this directly in PHP. However, there are command-line tools available that could do it for you.

What you can do is place the executable for such a tool inside your project and run it from inside your project against the given file. You can execute server commands from PHP as well.

Maybe this will do the trick for you: https://www.verydoc.com/blog/is-there-an-api-or-library-for-converting-dwg-to-any-standard-image-format.html

1 like

Please or to participate in this conversation.