Skip to content
This repository has been archived by the owner on Jan 5, 2021. It is now read-only.

AWS Install? #6

Open
nitrag opened this issue Feb 25, 2016 · 10 comments
Open

AWS Install? #6

nitrag opened this issue Feb 25, 2016 · 10 comments

Comments

@nitrag
Copy link

nitrag commented Feb 25, 2016

I was hoping that adding these three as dependencies would be all we need to do. Why doesn't just adding dependencies work?

"imagemagick":"*",
"gm":"*",
"parse-image":"*",
@flovilmart
Copy link
Owner

imagemagick and gm are not nodejs packages but binaries. they need to be installed by the proper package manager.

What are you using in AWS? elastic beanstalk?

@nitrag
Copy link
Author

nitrag commented Feb 25, 2016

Yea using ElasticBeanstalk. I swear I saw them on npm....

Here's the error I get:

thumbnail creation error: undefined(Could not execute GraphicsMagick/ImageMagick: identify "-ping" "-format" "%wx%h" "-" this most likely means the gm/convert binaries can't be found)

@flovilmart
Copy link
Owner

have a look there:

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html

and here:

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/ebextensions.html

basically:

create .ebextensions folder at the root of your project
create parse-image.config file

in parse-image.config:

packages: 
  apt:
    graphicsmagick: [] 
    imagemagick: []
  yum:
    GraphicsMagick: []
    ImageMagick: []

deploy

OR

http://stackoverflow.com/questions/29571394/graphicsmagick-not-working-in-elastic-beanstalk-with-nodejs-and-s3

@nitrag
Copy link
Author

nitrag commented Feb 25, 2016

oh, you are saying to USE the binaries and not nodejs packages...gotya..will report back with proper EB config once I get it working

@flovilmart
Copy link
Owner

not sure if your image use the AWS AMI or a debian, for sure it works with APT like described. never tested with yum.

@nitrag
Copy link
Author

nitrag commented Feb 25, 2016

Yep i did that, I even added libpng and libjpeg because I thought that was what is causing the decode error

packages:
  yum:
    libpng: []
    libjpeg-turbo: []
    ImageMagick: []
    GraphicsMagick: []
CLOUD CODE: 
function createThumbnail(buffer, maxWidth, maxHeight){
    var Image = require("parse-image");
    Parse.Cloud.useMasterKey();

    console.log("Generating Thumbnail...");
    var image = new Image();
    return image.setData(buffer).then(function(image) {
        var ratioX = maxWidth / image.width();  
        var ratioY = maxHeight / image.height();
        var ratio = Math.min(ratioX, ratioY);

        var w = image.width() * ratio;
        var h = image.height() * ratio;
        return image.scale({width: w, height: h});
    }).then(function(image) {
        // Make sure it's a JPEG to save disk space and bandwidth.
        return image.setFormat("JPEG"); 
    }).then(function(image) {
        // Get the image data in a Buffer.
        return image.data(); 
    }).then(function(buffer) {
        // Save the image into a new file.
        return buffer.toString("base64");
    }).then(function(base64) {
        var shrunk = new Parse.File("thumbnail.jpg", { base64: base64 });
        return shrunk.save(); 
    });
}

NODEJS ERROR:
Generating Thumbnail...
thumbnail creation error: 1(Command failed: identify: no decode delegate for this image format `/tmp/magick-Q9qAf2eM' @ error/constitute.c/ReadImage/544.
)

@flovilmart
Copy link
Owner

At what point is that error thrown?

@nitrag
Copy link
Author

nitrag commented Feb 25, 2016

from what I can tell

image.setData(buffer)

yum logs on beanstalk say imagemagick and graphicsmagick installed successfully.

Feb 25 18:21:05 Installed: jasper-libs-1.900.1-16.9.amzn1.x86_64
Feb 25 18:21:05 Installed: libXfixes-5.0.1-2.1.8.amzn1.x86_64
Feb 25 18:21:07 Installed: urw-fonts-2.4-10.7.amzn1.noarch
Feb 25 18:21:17 Installed: libtool-ltdl-2.4.2-20.4.8.3.31.amzn1.x86_64
Feb 25 18:21:17 Installed: mesa-dri-filesystem-10.1.2-2.32.amzn1.x86_64
Feb 25 18:21:18 Installed: jbigkit-libs-2.0-11.4.amzn1.x86_64
Feb 25 18:21:18 Installed: libtiff-4.0.3-20.20.amzn1.x86_64
Feb 25 18:21:18 Installed: libwmf-lite-0.2.8.4-41.11.amzn1.x86_64
Feb 25 18:21:18 Installed: libXt-1.1.4-6.1.9.amzn1.x86_64
Feb 25 18:21:18 Installed: libXdamage-1.1.3-4.7.amzn1.x86_64
Feb 25 18:21:18 Installed: libpciaccess-0.13.1-4.1.11.amzn1.x86_64
Feb 25 18:21:18 Installed: libdrm-2.4.52-4.12.amzn1.x86_64
Feb 25 18:21:18 Installed: libXxf86vm-1.1.3-2.1.9.amzn1.x86_64
Feb 25 18:21:18 Installed: mesa-dri-drivers-10.1.2-2.32.amzn1.x86_64
Feb 25 18:21:19 Installed: mesa-libGL-10.1.2-2.32.amzn1.x86_64
Feb 25 18:21:19 Installed: mesa-dri1-drivers-7.11-8.7.amzn1.x86_64
Feb 25 18:21:19 Installed: libwebp-0.3.0-3.5.amzn1.x86_64
Feb 25 18:21:21 Installed: ghostscript-fonts-5.50-23.2.7.amzn1.noarch
Feb 25 18:21:21 Installed: gnutls-2.8.5-18.14.amzn1.x86_64
Feb 25 18:21:21 Installed: avahi-libs-0.6.25-12.17.amzn1.x86_64
Feb 25 18:21:21 Installed: 1:cups-libs-1.4.2-67.21.amzn1.x86_64
Feb 25 18:21:21 Installed: pixman-0.32.4-4.11.amzn1.x86_64
Feb 25 18:21:21 Installed: cairo-1.12.14-6.8.amzn1.x86_64
Feb 25 18:21:22 Installed: ghostscript-8.70-19.23.amzn1.x86_64
Feb 25 18:21:23 Installed: ImageMagick-6.7.8.9-10.18.amzn1.x86_64
Feb 25 18:21:23 Installed: GraphicsMagick-1.3.20-3.5.amzn1.x86_64

Code is working on parse.com. Haven't changed anything.

@flovilmart
Copy link
Owner

@nitrag this is a reverse engineered version of the official one :) I'll dig deeper.

@flovilmart
Copy link
Owner

Seems to be the same as #7

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

No branches or pull requests

2 participants