Need you know, the spesification is:
*/ Server using Nginx. */ Framework Laravel 5.1. */ Image Intervention Library. */ Retrofit android API RestClient library.
When I uploading a image with size <1mb it's working right. But if the image >1mb file, I getting error 502 Bad Gateway (Using Postman). If I using my android apps, file with <1mb I get response 200(OK), but if file with >1mb I can't retrive anything response code.
This is my php code with image intervention library:
public function move_uploaded_to_tmp($file){
//render name
$name = $this->render_name();
$ori_ext = $file->getClientOriginalExtension();
//move to tmp storage
$file->move($this->tmp_directory, "{$name}.{$ori_ext}");
return $name.'.'.$ori_ext;
}
public function handle_tmp_img($filename){
$file_tmp = Storage::get('tmp'.DIRECTORY_SEPARATOR.$filename);
$alias_name = $this->render_name(); // ini alias name untuk thumbnail directory
$image = Image::make($file_tmp);
// encode image to png
$image->encode($this->ext_file);
// save original
$image->save($this->original_directory.$filename.'.'.$this->ext_file);
//resize
$image->resize(300,300);
// save resized
$image->save($this->thumbnail_directory.$alias_name.'.'.$this->ext_file);
$img->destroy();
// delete tmp file
@unlink($this->tmp_directory.$filename);
return $alias_name;
}
When I disable $image->save(); it's not return error but file just created in tmp folder(cannot created to oroginal and thumbnail folder)..
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire