Welcome Guest, Not a member yet? Register   Sign In
Unable to save the image.
#4

thank's a lot durairaj!

a combination of each code work's!

$image = \Config\Services::image();
$file = $this->request->getFile('imatge');

if($file->isValid())
{
$any=date("y"); if(strlen($any)==1){$any="0".$any;}
$mes=date("m"); if(strlen($mes)==1){$mes="0".$mes;}
$dia=date("d"); if(strlen($dia)==1){$dia="0".$dia;}
$hor=date("H"); if(strlen($hor)==1){$hor="0".$hor;}
$min=date("i"); if(strlen($min)==1){$min="0".$min;}
$seg=date("s"); if(strlen($seg)==1){$seg="0".$seg;}

$rand = rand(1000,9999);

$path = $file->getPath();
$ext = $file->getExtension();
$nom_arxiu = 'img'."_".$rand."_".$any.$mes.$dia."_".$hor.$min.$seg.".".$ext;

$PATH = getcwd();

$image->withFile($path.'/'.$file->getFileName())
->resize(600, 600)
->save($PATH .'/assets/img/equips/'. $nom_arxiu, 60);
// falta update BBDD
}
else
{
d(phpinfo());
d($file->getErrorString());
}
Reply


Messages In This Thread
Unable to save the image. - by aparedesv - 11-07-2019, 09:34 AM
RE: Unable to save the image. - by John_Betong - 11-07-2019, 07:53 PM
RE: Unable to save the image. - by durairaj - 11-07-2019, 10:42 PM
RE: Unable to save the image. - by aparedesv - 11-08-2019, 12:29 AM



Theme © iAndrew 2016 - Forum software by © MyBB