<commit_before>var multer          = require('multer')
var aws             = require('aws-sdk')
var multerS3        = require('multer-s3')
var request         = require('request');
var fs              = require('fs')
var gm              = require('gm');
var async           = require('async')
var imagesTypes     = require('../../models/image/imageTypes.json');
var models          = require('../../models');

aws.config.region = 'eu-west-1';

var s3 = new aws.S3({params: {Bucket: process.env.S3_BUCKET}});
var upload = multer({
  storage: multerS3({
    s3: s3,
    bucket: process.env.S3_BUCKET+'/'+process.env.IMAGES_FOLDER,
    metadata: function (req, file, callback) {
      callback(null, {fieldName: file.fieldname});
    },
    key: function (req, file, callback) {

        var image = new models.Image();
        var type = getTypeFromReq(req);
        image.type = type.name;
        image.mime = getMimeFromFile(file);

        if(!image.type || !image.mime){<commit_msg>server side: fix heroku image upload<commit_after>var multer          = require('multer')
var aws             = require('aws-sdk')
var multerS3        = require('multer-s3')
var request         = require('request');
var fs              = require('fs')
var gm              = require('gm'), imageMagick = gm.subClass({ imageMagick: true });
var async           = require('async')
var imagesTypes     = require('../../models/image/imageTypes.json');
var models          = require('../../models');

aws.config.region = 'eu-west-1';

var s3 = new aws.S3({params: {Bucket: process.env.S3_BUCKET}});
var upload = multer({
  storage: multerS3({
    s3: s3,
    bucket: process.env.S3_BUCKET+'/'+process.env.IMAGES_FOLDER,
    metadata: function (req, file, callback) {
      callback(null, {fieldName: file.fieldname});
    },
    key: function (req, file, callback) {

        var image = new models.Image();
        var type = getTypeFromReq(req);
        image.type = type.name;
        image.mime = getMimeFromFile(file);

        if(!image.type || !image.mime){
{'fraction_non_alphanumeric': 0.15907978463044542, 'fraction_numerical': 0.00978952520802741, 'mean_word_length': 2.5424610051993066, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4213932', 'n_tokens_mistral': 648, 'n_tokens_neox': 645, 'n_words': 148}