Love Fuel?
Donate
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
General
save image problem
atabak
October 2017
hi
i have problem when save image.
original image info : 2048*1365 - 175.5 kB - 72dpi
output image info : 2048*1365 - 1.0 MB - 96dpi (why?)
my code :
$savepath = 'assets'.DS.'img'.DS.'new';
$output_name = 'dsa';
$config = [
"path" => DOCROOT,
$savepath,
"randomize" => true,
"ext_whitelist" => ["jpg", "jpeg", "png"],
'quality' => 50,
];
if (\Input::file('asd'))
{
if (!is_dir(DOCROOT.$savepath))
{
\File::create_dir(DOCROOT, $savepath, 0755);
}
\Upload::process($config);
if (\Upload::is_valid())
{
\Upload::save(DOCROOT.$savepath);
$image_upload = \Upload::get_files();
$image_name = $output_name ?: $image_upload[0]["saved_as"];
\Image::load(DOCROOT.$savepath.DS.$image_upload[0]["saved_as"])
->save(DOCROOT.$savepath.DS.$output_name.'.'.$image_upload[0]["extension"]);
echo str_replace("\\", "/", $savepath.DS.$image_name.'.'.$image_upload[0]["extension"]);
}
else
{
echo 'not valid';
}
}
else
{
echo 'no image';
}
pompex
October 2017
Accepted Answer
Maybe because you change the image quality?
'quality' => 50,
atabak
October 2017
hi
no i set image quality to 0 and 1 but no change in output image size (1mb)
Harro
October 2017
Not sure why you use the Image class and it's transformation properties to simply save an uploaded image? The upload class does that very well without any help?
Add a Comment
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
Categories
All Discussions
5,088
General
↳ General
3,364
↳ Job Board
13
↳ Installation & Setup
214
Packages
↳ Oil
213
↳ Orm
700
↳ Auth
260
Development
↳ Tips and Tutorials
126
↳ Code share
145
↳ Applications
52
In this Discussion
atabak
October 2017
Harro
October 2017
pompex
October 2017