Community

Forums » Feature Requests to Experts

Image optimisation - kraken.io

    • 92 posts
    November 22, 2018 1:20 PM EST

    Has anyone any plans to create a plugin that can use 3rd party image optimizations? 

     

    I used to use Kraken.io and it worked like a dream. I think this would be a well worthwhile plugin as when im checking developer themes they are taking a very long time to loads and it does seem to be more of an issue when there is a lot of images to load. With users uploading images that can be 5mb plus in size it would be ideal. 

     

    Thanks 

    • 92 posts
    November 27, 2018 5:37 PM EST
    Can I bump ?
    • 2797 posts
    November 28, 2018 5:06 AM EST

    LOL you just did sealed

  • November 30, 2018 1:36 AM EST

    Bump.

    Bump.

    Bump.

    Responsive images should be a thing. To be loaded via ajax after the site has loaded. Gifs would be ideal.

    • 92 posts
    January 18, 2019 5:46 PM EST

    I got this working myself,think ive mentioned it in another thread but I will share it here anyways incase someone looks. 

     

    I have managed to have all uploaded image files optimised using S3 for AWS , Lambda from AWS and Kraken.io api. 

     

    Get your Kraken Api key from kraken.io

    Create your S3 bucket.

    Create a Lambda Trigger for Each File Type ( .jpg .png .gif )

    Fill int he storage details on the social engine acp for S3 storage 

     

    Below is the code that will reduce the file size, just replace the 'REPLACE ME' with your details.

     

    var kraken = require('kraken') var https = require('https') var querystring = require('querystring') exports.handler = (event, context, callback) => { let records = event.Records for (let i = 0; i < records.length; i++) { getdata(records) } } //This is the lambda function to store images in s3 bucket function getdata (file) { let destination = file.s3.object.key //destination set to object key from s3 bucket let s3_bucket = file.s3.bucket.name // let imageSource = destination.split('/') imageSource = imageSource[imageSource.length - 1] if (imageSource.indexOf('rl-') === 0) { return } if (!(destination.indexOf('.jpg') > 0 || destination.indexOf('.png') > 0)) { return } var Kraken = require('kraken') var kraken = new Kraken({ 'api_key': 'REPLACE ME', // kraken.io api key 'api_secret': 'REPLACE ME' // kraken.io api secret key }) var bucketInfo = { url: 'https://s3.{location}.amazonaws.com/{bucketName}/' + destination, // replace bucketName and location. wait: true, lossy: false, resize: { // resize image according to your needs 'width': 800, 'height': 600, 'strategy': 'auto' }, 's3_store': { 'key': 'REPLACE ME', // replace bucket-key with your key 'secret': 'REPLACE ME', // replace bucket-secret key with your key 'bucket': 'bucketName', // replace bucketName with your name 'path': destination.replace(imageSource, 'rl-' + imageSource), 'region': 'eu-west-1' // replace bucket-region with your region } } //Callback function from server and failure message kraken.url(bucketInfo, function (data, status) { if (status && status.success) { } else { console.log('Fail. Error message: %s', JSON.stringify(data)) } }) };
    • 192 posts
    January 22, 2019 7:52 PM EST

    Peppa, Elshara - Thanks for this post. It looks real awesome.

    Not an expert,, but could sure use your help !!

     

    #1 How do you separate only the images of the social engine website to be stored say, in S3 or an external AWS EC2 bucket??

    * Its always been on my mind - cause we would love to do that , so that we can optimize images.

    (We use all SEAO plugins currently )

     

    #2 Is it possible to store audio/video & photos separately from the main volume (we use aws) ???

     

    Your help and expertise would be greatly appreciated.:))

     

    Thanks in advance.!

     

     

     

    • 192 posts
    January 30, 2019 5:55 AM EST

    If anyone can help explain how to implement this to rookie,

    heres where I've opened a new thread,.

    https://community.socialengine.com/forums/topic/1586/separating-audio-video-photoson-s3-and-kraken-optimize

    Thanks !