Fatal error: Class 'wiImage' not found
I include WideImage library but resizing does not work; isntead it says 'Fatal error: Class 'wiImage' not found'
include('WideImageLib/lib开发者_如何学运维/WideImage.php');
$img = wiImage::load($_FILES['image']['tmp_name']);
$res = $img->resize('50%');
imagejpeg($res, 'images/'.$_FILES['image']['name']);
That would be because the class is called WideImage
and the load call needs to be WideImage::load
. You should probably read the documentation again.
And since you're working with an upload, you can use a shortcut:
$img = WideImage::load('image')
Also, all of your code (except the include statement) can be done as a one-liner:
WideImage::load('image')->resize('50%')->saveToFile('images/' . $_FILES['image']['name']);
From a quick look at their SourceForge page, it looks like it should be WideImage
WideImage::load($_FILES['image']['tmp_name']);
精彩评论