implemented imagemagick for resizing images and prevent crashing