Support the ongoing development of Laravel.io →
posted 5 years ago
Laravel

I have integrated Intervention Image library (v-2.5) into my laravel application (v-5.1) to resize images. It is working fine in local server, but when i deploy it to live server i'm getting this error: Unsupported image type. GD driver is only able to decode JPG, PNG, GIF or WebP files. . My image size is 18kb and its mime type is jpg. So there is nothing wrong with my image. Here is my code that i'm using for convertion and saving to server:

			foreach ($request->images as $file) {
                // getting file name with extension
				$imageName = getFileName($file);

				$homeworkImage = new HomeworkImage();
				$homeworkImage->tbl_homework_id = $homework->homework_id;
				$homeworkImage->image_name = $imageName;

				if ($homeworkImage->save()) {
					// $file->move('uploads/homework', $imageName);

					$image_resize = Image::make($file->getRealPath());
					$image_resize->resize(300, 300);
					$image_resize->save('uploads/homework/' . $imageName);
				}
			}

If i try to upload the image normally, that it is working fine. Can anyone point me out if i'm missing something!

Last updated 3 years ago.
0

Do you have every dependencies installed in the live server ?

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.