【问题标题】:Aviary and Codeigniter saving blank fileAviary 和 Codeigniter 保存空白文件
【发布时间】:2014-04-18 21:00:52
【问题描述】:

所以我正在使用 Aviary 来编辑我的图片,并且我有一个运行该应用程序的脚本。

<script type='text/javascript'>
var featherEditor = new Aviary.Feather({
    apiKey: '',
    apiVersion: 3,
    theme: 'light', // Check out our new 'light' and 'dark' themes!
    tools: 'all',
    appendTo: '',
    onSave: function (imageID, newURL) {

    },
    postUrl: 'http://beta.usd309bands.org/upload/saveEditiedImage/',
    onError: function (errorObj) {
        alert(errorObj.message);
    }
});

function launchEditor(id, src) {
    featherEditor.launch({
        image: id,
        url: src
    });
    return false;
}
</script>

然后我用编辑后的图像替换现有图像的php代码如下:

$image_data = file_get_contents($_REQUEST['url']);

file_put_contents("static/images/gallery/image1.jpg",$image_data);

此脚本与现有文件联系并覆盖它。但它会覆盖它什么都不是。只是一个空的image1.jpg 文件。

我在这里做错了什么?我还需要在 php 文件中做什么?

【问题讨论】:

  • 尝试回显$image_data。你得到了什么?
  • 我从来没有真正看到过处理 php 的页面。它有点像ajax 所以即使我回显$image_data 我什么也看不到。

标签: php codeigniter aviary


【解决方案1】:

好的,所以我在 php 文件中的所有内容都非常正确并且可以正常工作。问题发生在我自己的编码之外。

服务器有两个必须满足的 php 配置来处理这个操作。

allow_url_fopen MUST BE EQUAL TO 1
allow_url_fopen='1';  // My Values 

post_max_size MUST BE GREATER THAN THE IMAGE YOU ARE SAVING 
post_max_size ='120M'; // My Values

【讨论】:

    猜你喜欢
    • 2014-06-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-13
    • 1970-01-01
    相关资源
    最近更新 更多