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
error: Call to undefined method Fuel\Core\Image::factory()
Edzel
January 2017
I ask if what is the problem with this here's my code
if (Upload::is_valid())
{
// save them according to the config
Upload::save();
// call a model method to update the database
$file = Upload::get_files();
foreach ($file as $savefile) {
var_dump($savefile);
}
$filepath=$savefile['saved_to'].$savefile['saved_as'];
$width=640;
$height=480;
Image::factory()->load($filepath) ->resize($width, $height) ->save($filepath); /* <- error */
}
Harro
January 2017
As the error says, there is no such method. See the docs:
http://fuelphp.com/docs/classes/image.html
Edzel
January 2017
My fuel/app/config/image.php is empty
when I tried to add this code:
http://fuelphp.com/docs/classes/image.html#/presets
The error is also the same.
:(
Harro
January 2017
What part of "that method does not exist" did you not understand?
You get the same error if you use Image::somerandommethodthatdoesnotexist();
Edzel
January 2017
I understand a bit but not totally.
I just don't know what to put in app/config/image.php. (newbie here
:)
)
Harro
January 2017
Accepted Answer
What goes in there or not is not a problem.
Your code uses Image::factory(), but the Image class does not contain a method called "factory", which is why you have this error. You have an error in your code, not your config.
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
Edzel
January 2017
Harro
January 2017