Javascript image compression before AES encryptsetting canvas toDataURL jpg qualityCreate GUID / UUID in JavaScript?How do JavaScript closures work?What is the most efficient way to deep clone an object in JavaScript?How do I remove a property from a JavaScript object?Which equals operator (== vs ===) should be used in JavaScript comparisons?How do I include a JavaScript file in another JavaScript file?What does “use strict” do in JavaScript, and what is the reasoning behind it?How to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?For-each over an array in JavaScript?
What's the meaning of こそ in this sentence?
I have accepted an internship offer. Should I inform companies I have applied to that have not gotten back to me yet?
How to calculate difference in AnyDice?
Why does the Earth have a z-component at the start of the J2000 epoch?
What systems of robust steganography are out there?
Doing research in academia and not liking competition
Why did Spider-Man take a detour to Dorset?
What made Windows ME so crash-prone?
What exactly is a Hadouken?
Applying for a USA B1/B2 Visa for an alien resident in Germany
Is this artwork (used in a video game) real?
How to honestly answer questions from a girlfriend like "How did you find this place" without giving the impression I'm always talking about my exes?
Why do the faithful have to say "And with your spirit " in Catholic Mass?
Source of story about the Vilna Gaon and immigration policy
When does Fisher's "go get more data" approach make sense?
How could an animal "smell" carbon monoxide?
Is there any way for an Adventurers League, 5th level Wizard, to gain heavy armor proficiency?
Can I send medicine to someone in Canada?
Why run a service as a system user?
Can't update Ubuntu 18.04.2
Getting fresh water in the middle of hypersaline lake in the Bronze Age
Accidentally deleted python and yum is not working in centos7
What to look for in climbing shoes?
What do these three diagonal lines that cross through three measures and both staves mean, and what are they called?
Javascript image compression before AES encrypt
setting canvas toDataURL jpg qualityCreate GUID / UUID in JavaScript?How do JavaScript closures work?What is the most efficient way to deep clone an object in JavaScript?How do I remove a property from a JavaScript object?Which equals operator (== vs ===) should be used in JavaScript comparisons?How do I include a JavaScript file in another JavaScript file?What does “use strict” do in JavaScript, and what is the reasoning behind it?How to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?For-each over an array in JavaScript?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I need to AES encrypt fileupload images with javascript before storing to the server but I'm running into LONGTEXT limitations when trying to store as custom field in MySQL. That method involved converting image to base64 and then encrypting.
I'm looking for a method to achieve the smallest string possible from that image upload before encrypting. Or at the very least how to reduce the image under a specified byte maximum.
<input id="foo" type="file" />
Encrypt with CryptoJS
$(document).on("change", "#foo", function()
var chatImg = $(this).val();
// COMPRESS IMAGE
var keyAES = "123456789";
var eImg = CryptoJS.AES.encrypt(chatImg, keyAES).toString();
console.log(eImg);
);
Note: I've searched far and wide for a solution but the only ones I found involved set image widths/heights
javascript file base64
add a comment |
I need to AES encrypt fileupload images with javascript before storing to the server but I'm running into LONGTEXT limitations when trying to store as custom field in MySQL. That method involved converting image to base64 and then encrypting.
I'm looking for a method to achieve the smallest string possible from that image upload before encrypting. Or at the very least how to reduce the image under a specified byte maximum.
<input id="foo" type="file" />
Encrypt with CryptoJS
$(document).on("change", "#foo", function()
var chatImg = $(this).val();
// COMPRESS IMAGE
var keyAES = "123456789";
var eImg = CryptoJS.AES.encrypt(chatImg, keyAES).toString();
console.log(eImg);
);
Note: I've searched far and wide for a solution but the only ones I found involved set image widths/heights
javascript file base64
If you can't compromise on width/height, you'll need to compromise on encoding quality.
– samgak
Mar 26 at 7:29
I'm open to resizing the image under a byte maximum before encryption although I have no idea how. What do you mean exactly by encoding quality?
– user300979
Mar 26 at 7:49
JPEG is a lossy image format. How lossy depends on the encoding parameters. When you encode an image you can specify a value that determines how aggressively to compress the data. See here: stackoverflow.com/questions/14383557/…
– samgak
Mar 26 at 7:53
add a comment |
I need to AES encrypt fileupload images with javascript before storing to the server but I'm running into LONGTEXT limitations when trying to store as custom field in MySQL. That method involved converting image to base64 and then encrypting.
I'm looking for a method to achieve the smallest string possible from that image upload before encrypting. Or at the very least how to reduce the image under a specified byte maximum.
<input id="foo" type="file" />
Encrypt with CryptoJS
$(document).on("change", "#foo", function()
var chatImg = $(this).val();
// COMPRESS IMAGE
var keyAES = "123456789";
var eImg = CryptoJS.AES.encrypt(chatImg, keyAES).toString();
console.log(eImg);
);
Note: I've searched far and wide for a solution but the only ones I found involved set image widths/heights
javascript file base64
I need to AES encrypt fileupload images with javascript before storing to the server but I'm running into LONGTEXT limitations when trying to store as custom field in MySQL. That method involved converting image to base64 and then encrypting.
I'm looking for a method to achieve the smallest string possible from that image upload before encrypting. Or at the very least how to reduce the image under a specified byte maximum.
<input id="foo" type="file" />
Encrypt with CryptoJS
$(document).on("change", "#foo", function()
var chatImg = $(this).val();
// COMPRESS IMAGE
var keyAES = "123456789";
var eImg = CryptoJS.AES.encrypt(chatImg, keyAES).toString();
console.log(eImg);
);
Note: I've searched far and wide for a solution but the only ones I found involved set image widths/heights
javascript file base64
javascript file base64
asked Mar 26 at 7:23
user300979user300979
311 gold badge2 silver badges12 bronze badges
311 gold badge2 silver badges12 bronze badges
If you can't compromise on width/height, you'll need to compromise on encoding quality.
– samgak
Mar 26 at 7:29
I'm open to resizing the image under a byte maximum before encryption although I have no idea how. What do you mean exactly by encoding quality?
– user300979
Mar 26 at 7:49
JPEG is a lossy image format. How lossy depends on the encoding parameters. When you encode an image you can specify a value that determines how aggressively to compress the data. See here: stackoverflow.com/questions/14383557/…
– samgak
Mar 26 at 7:53
add a comment |
If you can't compromise on width/height, you'll need to compromise on encoding quality.
– samgak
Mar 26 at 7:29
I'm open to resizing the image under a byte maximum before encryption although I have no idea how. What do you mean exactly by encoding quality?
– user300979
Mar 26 at 7:49
JPEG is a lossy image format. How lossy depends on the encoding parameters. When you encode an image you can specify a value that determines how aggressively to compress the data. See here: stackoverflow.com/questions/14383557/…
– samgak
Mar 26 at 7:53
If you can't compromise on width/height, you'll need to compromise on encoding quality.
– samgak
Mar 26 at 7:29
If you can't compromise on width/height, you'll need to compromise on encoding quality.
– samgak
Mar 26 at 7:29
I'm open to resizing the image under a byte maximum before encryption although I have no idea how. What do you mean exactly by encoding quality?
– user300979
Mar 26 at 7:49
I'm open to resizing the image under a byte maximum before encryption although I have no idea how. What do you mean exactly by encoding quality?
– user300979
Mar 26 at 7:49
JPEG is a lossy image format. How lossy depends on the encoding parameters. When you encode an image you can specify a value that determines how aggressively to compress the data. See here: stackoverflow.com/questions/14383557/…
– samgak
Mar 26 at 7:53
JPEG is a lossy image format. How lossy depends on the encoding parameters. When you encode an image you can specify a value that determines how aggressively to compress the data. See here: stackoverflow.com/questions/14383557/…
– samgak
Mar 26 at 7:53
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55351738%2fjavascript-image-compression-before-aes-encrypt%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55351738%2fjavascript-image-compression-before-aes-encrypt%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
If you can't compromise on width/height, you'll need to compromise on encoding quality.
– samgak
Mar 26 at 7:29
I'm open to resizing the image under a byte maximum before encryption although I have no idea how. What do you mean exactly by encoding quality?
– user300979
Mar 26 at 7:49
JPEG is a lossy image format. How lossy depends on the encoding parameters. When you encode an image you can specify a value that determines how aggressively to compress the data. See here: stackoverflow.com/questions/14383557/…
– samgak
Mar 26 at 7:53