I can't upload image with codeigniter and get following error.
A PHP Error was encountered
Severity: Warning
Message: imagecreatefromjpeg(): gd-jpeg, libjpeg: recoverable error: Invalid SOS parameters for sequential JPEG
Filename: libraries/Image_lib.php
Line Number: 1455A PHP Error was encountered
Severity: Warning
Message: imagecreatefromjpeg(): '/home/gsgsadh/public_html/uploads/a31d12f51b36659f5456e2530237e779.jpg' is not a valid JPEG file
Filename: libraries/Image_lib.php
Line Number: 1455
function image_create_gd
at application/libraries/MY_Image_lib.php
public function image_create_gd($path = '', $image_type = '')
{
if ($path === '')
{
$path = $this->full_src_path;
}
if ($image_type === '')
{
$image_type = $this->image_type;
}
switch ($image_type)
{
case 1:
if ( ! function_exists('imagecreatefromgif'))
{
$this->set_error(array('imglib_unsupported_imagecreate', 'imglib_gif_not_supported'));
return FALSE;
}
return imagecreatefromgif($path);
case 2:
if ( ! function_exists('imagecreatefromjpeg'))
{
$this->set_error(array('imglib_unsupported_imagecreate', 'imglib_jpg_not_supported'));
return FALSE;
}
/*No.1455*/ return imagecreatefromjpeg($path); //****Line number is 1455****
case 3:
if ( ! function_exists('imagecreatefrompng'))
{
$this->set_error(array('imglib_unsupported_imagecreate', 'imglib_png_not_supported'));
return FALSE;
}
return imagecreatefrompng($path);
default:
$this->set_error(array('imglib_unsupported_imagecreate'));
return FALSE;
}
}
what's the solution? How to change the code?