Cloudinary_js integration with ember

I am working on my first electronic application using Ember-cli

Here I want to add an image upload function using cloudinary_js

Referring to the link

Image Model:

import DS from 'ember-data';
var attr = DS.attr;

export default DS.Model.extend({
  imageUrl:         attr('string'),
  thumbImageUrl:    attr('string'),
  standardImageUrl: attr('string'),
  favourite:        attr('string'),
  order:            attr('number')
});

I already added the necessary js files using the gazebo and listed them in Brocfile.js

app.import('vendor/jquery-ui/jquery-ui.js');
app.import('vendor/jquery.iframe-transport/jquery.iframe-transport.js');
app.import('vendor/blueimp-file-upload/js/jquery.fileupload.js');
app.import('vendor/cloudinary_js/js/jquery.cloudinary.js');

Added file field as component:

import Ember from "ember";

export default Ember.View.extend({
  tagName: "input",
  type: "file",
  accept: "image/*",
  class: "cloudinary-fileupload",
  dataCloudinaryField: "image_id",
  attributeBindings: [ "name", "type", "value", "class"],
  change: function() {
  }
});

Stuck here, where to specify the cloud configuration (cloud name and api key)?

Can someone help me with the detailed steps of cloud integration with ember using ember-cli.

Thank.

+4
source share
1 answer

, cloud_name api_key. app/initializers/cloudinary.js.

export default {
  name: 'cloudinary',

  initialize: function() {
    $.cloudinary.config({
      cloud_name: 'MYCLOUD',
      api_key:    'MYKEY'
    });
  }
};

cloudinary_js Ember . , ember-cli , CloudMan , . , , , .

+2

Source: https://habr.com/ru/post/1547687/


All Articles