Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello @mpybkk, I just bumped into the same issue. Do you have any hint to solve?
    I will try to debug the issue…

    OK, I found the fix. The answer was in this thread.

    https://github.com/deliciousbrains/wp-amazon-s3-and-cloudfront/issues/285

    I was making exactly the same error.
    Solution was to change

    $image[‘type’] = ‘image/jpg’;
    to
    $image[‘type’] = ‘image/jpeg’;

    In my case, I am using https://github.com/scottgonzalez/node-wordpress
    and the following code upload images to S3. Previously I was specifying type: ‘image/jpg’ which caused images to upload to the host instead of S3.

    const fsp = require('fs-promise')
          fsp.readFile(path).then(
            (data) => {
              const file = {
                name: path.slice(path.lastIndexOf('/') + 1),
                type: 'image/jpeg',
                bits: data,
                overwrite: true
              }
    
              console.log(<code>Upload ${file.name} via XML-RPC</code>)
              this._wp.uploadFile(file, (err, res) => {
                if (err) {
                  console.log(err)
                  reject(err)
                } else {
                  console.log(res)
                  resolve(res)
                }
              })
            },
            (err) => {
              console.log(err)
            }
          )
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘S3/Cloudfront & XML-PRC with S3 Offload?’ is closed to new replies.