XF 2.1 Handling images

AndrewSimm

Well-known member
I am able to upload an image but would also like to resize it and use other functions in XF\Image\AbstractDriver

How do I tell AbstractDriver what image I am working with? Any examples would be awesome!

PHP:
\XF\Util\File::createDirectory('data://articles' . $thread_id . '/' . $post_id);
\XF\Util\File::copyFileToAbstractedPath($tempFile, $abstractedPath);
\XF\Image\AbstractDriver::resizeTo(80,80);
 
Use the image manager to get an instance of the current driver for the file in question:

PHP:
$image = \XF::app()->imageManager()->imageFromFile($sourceFile);
 
Top Bottom