Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command failed: /bin/sh -c identify -format "name=size=%[size] etc... #74

Open
VesperDev opened this issue Feb 17, 2016 · 2 comments
Open
Labels

Comments

@VesperDev
Copy link

hello community have the following doubt'm trying to do the resize an image that I have in the following path of aws /imgnormal/quiko.jpeg

almost copy the code replacing keys aws

 var express = require('express');
 var bodyParser = require('body-parser');
 var im = require('imagemagick'); 
 var Upload = require('s3-uploader');

 var client = new Upload('my-buckets',{

  aws : {
    region : 'us-west-2',
    path : 'images/',
    acl: 'public-read',
    accessKeyId : 'aaaa',
    secretAccessKey  : 'bbbb'
  },
  cleanup: {
    versions: true,
    original: false
  },original: {
    awsImageAcl: 'private'
  },
  versions: [{
    maxHeight: 1040,
    maxWidth: 1040,
    format: 'jpg',
    suffix: '-large',
    quality: 80,
    awsImageExpires: 31536000,
    awsImageMaxAge: 31536000
  },{
    maxWidth: 780,
    aspect: '3:2!h',
    suffix: '-medium'
  },{
    maxWidth: 320,
    aspect: '16:9!h',
    suffix: '-small'
  },{
    maxHeight: 100,
    aspect: '1:1',
    format: 'png',
    suffix: '-thumb1'
  },{
    maxHeight: 250,
    maxWidth: 250,
    aspect: '1:1',
    suffix: '-thumb2'
  }]

});

create this route for test

app.post('/Test', function(req, res) {

  client.upload('imgnormal/quiko.jpeg', {}, function(err, versions, meta) {
      if (err) {
        console.log('----Nope-------', err.message);
        return res.status(400).send('KO');
      }
      console.log('----Success----', versions, data);
      return res.status(200).send('OK');
  });

};

to make the request to the resize the image I have this error

 ----Nope------- Command failed: /bin/sh -c identify -format "name=
size=%[size]
format=%m
colorspace=%[colorspace]
height=%[height]
width=%[width]
orientation=%[orientation]
identify.im6: unable to open image `imgnormal/quiko.jpeg': No such file or directory @ error/blob.c/OpenBlob/2638.

was researching the problem and here's the solution did not have installed imagemagick #73
put the var im = require ( 'imagemagick'); and yet I have this error
in my package.json i have this dependencies

"dependencies": {
    "ejs": "2.3.3",
    "express": "~4.2.x",
    "imagemagick": "^0.1.3",
    "s3-uploader": "^1.1.0"
  },

path the imagemagick https://github.com/rsms/node-imagemagick
what i do wrong in the code?

thanks for your time.

@Starefossen
Copy link
Contributor

Hi @VesperDev and sorry for the trouble.

This error says that the image imgnormal/quiko.jpeg was not found on your computer. To rephrase it, the image imgnormal/quiko.jpeg must be on the same physical location as your program in order for s3-uploader to access it. If this image is already on AWS you need to download it first before you can resize it.

@VesperDev
Copy link
Author

Hi @Starefossen thanks for help me
these days I have spent my researched how to use S3-uploader
I aws s3 in the folder structure as follows

aws1

aws2

I have this code

var im = require('imagemagick');
var Upload = require('s3-uploader');

var client = new Upload('bucketfileql', {

aws: {
region: 'us-west-2',
path: 'images/',
acl: 'public-read',
accessKeyId: 'aaaa',
secretAccessKey: 'aaaa',
endpoint: 'https://endpoint.amazonaws.com',
},
versions: [{
maxWidth: 780,
aspect: '3:2!h',
suffix: '-medium'
}, {
maxWidth: 320,
aspect: '16:9!h',
suffix: '-small'
}]

});

app.post('/resizeImg',function(req,res){

client.upload('https://endpoint.amazonaws.com/bucketfileql/imgnormal/quiko.jpeg', {}, function(err, versions, meta) {

if (err) {
  console.log('----Nope-------', err.message);
  return res.status(400).send('NO');
}
console.log('----Success----', versions, data);
return res.status(200).send('YES');

});

});

aws.path as I understand is the path where to save the resize of images
client.upload('https://endpoint.amazonaws.com/bucketfileql/imgnormal/quiko.jpeg') on this route is where my image

but at the time of the request I have this error :(

Error:
----Nope------- Command failed: /bin/sh -c convert https://s3-us-west-1.amazonaws.com/bucketfileql/imgnormal/quiko.jpeg -auto-orient -strip -write mpr:https://s3-us-west-1.amazonaws.com/bucketfileql/imgnormal/quiko.jpeg +delete mpr:https://s3-us-west-1.amazonaws.com/bucketfileql/imgnormal/quiko.jpeg -quality 70 -crop "852x567+3+0" -resize "780" -write https:/s3-us-west-1.amazonaws.com/bucketfileql/imgnormal/quiko-medium.jpeg +delete mpr:https://s3-us-west-1.amazonaws.com/bucketfileql/imgnormal/quiko.jpeg -quality 70 -crop "858x483+0+42" -resize "320" https:/s3-us-west-1.amazonaws.com/bucketfileql/imgnormal/quiko-small.jpeg
2016-02-19T07:11:38.746282+00:00 app[web.1]: convert.im6: unable to open image `https:/s3-us-west-1.amazonaws.com/bucketfileql/imgnormal/quiko-medium.jpeg': No such file or directory @ error/blob.c/OpenBlob/2638.
2016-02-19T07:11:38.746283+00:00 app[web.1]:

I do not understand why you have to find the picture on this route https: /s3-us-west-1.amazonaws.com/bucketfileql/imgnormal/quiko-medium.jpeg

I'm using ImageMagick 6.7.7-10 heroku and Q16 06/03/2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants