您好我在laravel
项目中使用滑行(http://glide.thephpleague.com/)进行图像处理。
我在存储图像时遇到问题。
“调用未定义的函数Intervention\Image\Gd\imagecreatefrompng()
”
奇怪的是我可以在我的Mac上用“预览”打开图像。但不是在浏览器中。 Photoshop也告诉我这个文件有问题,它已经损坏了。
这是我将图像保存在私人文件夹中的方式:
public function update(Request $request, $id)
{
//Show the image
echo '<img src="'.$_POST['img_val'].'" />';
//Get the base-64 string from data
$filteredData=substr($_POST['img_val'], strpos($_POST['img_val'], ",")+1);
//Decode the string
$unencodedData=base64_decode($filteredData);
//Save the image
$storagepath = storage_path('app/images/users/' . Auth::user()->id);
$imgoutput = File::put($storagepath.'/flyer.jpg', $unencodedData);
return view('backend.flyers.index')->withImgoutput($imgoutput);
//->withStoragepath($storagepath);
}
似乎File :: put(XXX。 jpg ) JPG 会导致问题。 我该如何解决这个问题?
答案 0 :(得分:1)
这是因为缺少<link href="http://code.ionicframework.com/1.3.1/css/ionic.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ngDraggable/0.1.10/ngDraggable.js"></script>
<div ng-app="MyApp" ng-controller="MyCtrl" class="body">
Categorize the animals based on their reproductive system
<div class="row">
<div class="col">
<div class="list-of-drag-item" ng-drop="true" ng-drop-success="onDropComplete0($data,$event)">
<div ng-click="clickMe()" ng-repeat="obj in droppedObjects0" ng-drag="true" ng-drag-data="obj"
ng-drag-success="onDragSuccess0($data,$event)" ng-center-anchor="{{centerAnchor}}">
{{obj.name}}
</div>
</div>
</div>
</div>
<div class="row" style="text-align: center;">
<div class="col div-left">
<span class="title">Animals that give birth
<div ng-drop="true" ng-drop-success="onDropComplete1($data,$event)">
<div ng-repeat="obj in droppedObjects1" ng-drag="true" ng-drag-data="obj"
ng-drag-success="onDragSuccess1($data,$event)" ng-center-anchor="{{centerAnchor}}">
{{obj.name}}
</div>
</div>
</div>
<div class="col div-right">
<span class="title">Animals that Laying Eggs</span>
<div ng-drop="true" ng-drop-success="onDropComplete2($data,$event)">
<div ng-repeat="obj in droppedObjects2" ng-drag="true" ng-drag-data="obj"
ng-drag-success="onDragSuccess2($data,$event)" ng-center-anchor="{{centerAnchor}}">
{{obj.name}}
</div>
</div>
</div>
</div>
</div>
。试试这个:
您必须启用库GD2。
找到(适当的)GD Library
文件
找到行:php.ini
并删除前面的分号。
该行应如下所示:
;extension=php_gd2.dll
然后重启apache,你应该好好去。