我使用了Slim Image Cropper和symfony 2,它具有响应性,非常适合移动设备和桌面设备,但是当我将它添加到我的symfony项目中时,我有点卡住了。
在上传中有一些文件很多是.js文件和一些php文件。
,我想以may形式上传一个头像,我在我的表单中使用它
<div class="slim" style="border-radius: 50%;"
data-label="drag your image here"
data-ratio="1:1"
data-service="async.php"
data-size="200,200">
{{ form_widget (form.imageFile ,{'name':'slim[]', 'attr': {'type': 'file'}} ) }}
</div>
裁剪后我有这样的输入:
<input type="file" id="imageFile" accept="image/jpeg,image/png,image/gif,image/bmp" style="margin-bottom: 100%;" aria-required="true"></input>
<input type="hidden" name="imageFile" value="{"server":null,"meta":null,"input":{"name":"140929113850-saeed-ahmed-profile-image-full-169.jpg","type":"image/jpeg","size":254064,"width":1600,"height":900},"output":{"width":200,"height":200,"image":"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB......">
....:很多我不理解的剧本
当我点击提交按钮时,我有这个错误: 类型&#34; Symfony \ Component \ HttpFoundation \ File \ File&#34;,&#34; string&#34;的预期参数;给定
如何成功解析Json图像对象到我的输入文件,所以我可以上传!!