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
LOL you just did
Bump.
Bump.
Bump.
Responsive images should be a thing. To be loaded via ajax after the site has loaded. Gifs would be ideal.
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))
}
})
};
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.!
If anyone can help explain how to implement this to rookie,
heres where I've opened a new thread,.
Thanks !
This is a great topic which I am looking to implement but I have a question. From the looks of this, this will only optimize images uploaded after the time of implementation. Is it possible to also optimize all the images already stored on S3?
I suppose it depends on how many you have unoptimized.
When i had a small amount I transferred from s3 to local storage and then back again.
Drawbacks to this are bandwidth usage, lamda trigger amounts and time.
We have about 290k images currently on S3 with a total storage of about 14gb. Not sure if transferring local and then back to S3 is the best option.
yeah probably best to not do that,
Thanks Guys,
Right Now I hvae local storage AND s3 enabled
All files have transferred to S3.
Qtn#1 Is it ok to disable Localstorage ? - It has only 13 files left.
Qtn#2 Should I change the default to S3?
Not sure how these settings in storage system works.
thanks PPK)
have good backups , so i can experiment and check
will try it