update origin

This commit is contained in:
solehudin5699
2023-02-19 00:27:41 +07:00
parent 60eae089d7
commit 67481f1d19
3 changed files with 10 additions and 23 deletions
+3 -1
View File
@@ -1,3 +1,5 @@
require('dotenv').config();
const express = require('express'); const express = require('express');
const path = require('path'); const path = require('path');
const bodyParser = require('body-parser'); const bodyParser = require('body-parser');
@@ -21,7 +23,7 @@ app.post('/', uploadMiddleware, (req, res) => {
res.json({ res.json({
success: true, success: true,
message: 'Success upload file', message: 'Success upload file',
urlImage: `https://img-resize-xxx.herokuapp.com/public/${req.file.filename}`, urlImage: `${process.env.ORIGIN}/public/${req.file?.filename}`,
}); });
}); });
+1
View File
@@ -10,6 +10,7 @@
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"body-parser": "^1.19.2", "body-parser": "^1.19.2",
"dotenv": "^16.0.3",
"express": "^4.17.3", "express": "^4.17.3",
"multer": "^1.4.4", "multer": "^1.4.4",
"sharp": "^0.28.3" "sharp": "^0.28.3"
+6 -22
View File
@@ -133,24 +133,12 @@
<div class="form-options"> <div class="form-options">
<div class="input-wrapper"> <div class="input-wrapper">
<label for="quality-input" class="label-option">Quality</label> <label for="quality-input" class="label-option">Quality</label>
<input <input id="quality-input" class="input-option-quality" type="range" max="100" min="1" />
id="quality-input"
class="input-option-quality"
type="range"
max="100"
min="1"
/>
<span id="value-quality" class="value-qty-img"></span> <span id="value-quality" class="value-qty-img"></span>
</div> </div>
<div class="checkbox-wrapper"> <div class="checkbox-wrapper">
<label for="use-dimension-input" class="label-option-checkbox" <label for="use-dimension-input" class="label-option-checkbox">Original Size</label>
>Original Size</label <input id="original-size-input" type="checkbox" class="checkbox-option" />
>
<input
id="original-size-input"
type="checkbox"
class="checkbox-option"
/>
</div> </div>
<div class="input-wrapper"> <div class="input-wrapper">
<label for="width-input" class="label-option">Width</label> <label for="width-input" class="label-option">Width</label>
@@ -179,9 +167,7 @@
</div> </div>
</div> </div>
<button id="btn-submit" class="btn-submit" type="submit"> <button id="btn-submit" class="btn-submit" type="submit">Submit & Download</button>
Submit & Download
</button>
</form> </form>
<a <a
@@ -231,9 +217,7 @@
btnBrowse.style.backgroundSize = 'cover'; btnBrowse.style.backgroundSize = 'cover';
btnBrowse.style.backgroundColor = 'transparent'; btnBrowse.style.backgroundColor = 'transparent';
btnBrowse.style.width = `70vw`; btnBrowse.style.width = `70vw`;
btnBrowse.style.height = `calc(${ btnBrowse.style.height = `calc(${imageFile.height / imageFile.width}*70vw)`;
imageFile.height / imageFile.width
}*70vw)`;
btnBrowse.style.placeContent = 'flex-end center'; btnBrowse.style.placeContent = 'flex-end center';
btnBrowse.innerHTML = 'Change Image'; btnBrowse.innerHTML = 'Change Image';
}; };
@@ -273,7 +257,7 @@
btnSubmit.innerHTML = 'Loading...'; btnSubmit.innerHTML = 'Loading...';
btnSubmit.setAttribute('disabled', true); btnSubmit.setAttribute('disabled', true);
fetch('https://img-resize-xxx.herokuapp.com/', { fetch('/', {
method: 'POST', method: 'POST',
headers: {}, headers: {},
body: formData, body: formData,