Skip to content

Commit

Permalink
indiv label download func added
Browse files Browse the repository at this point in the history
  • Loading branch information
diablo1408 committed Jan 7, 2021
1 parent bdefd8f commit aca14fe
Show file tree
Hide file tree
Showing 14 changed files with 439 additions and 191 deletions.
5 changes: 4 additions & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
EMAIL = "minorprojectcse2020@gmail.com"
PASSWORD = "wasd4321"
PASSWORD = "wasd4321"
cloud_name: 'dn8binf6d'
api_key: '858617943453819'
api_secret: 'SmFaiFXHwpB_ZGhUV9zyrdVXKMc'
25 changes: 25 additions & 0 deletions cloudinaryUpload.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
require('dotenv').load();
var fs = require('fs');
var cloudinary = require('cloudinary').v2;

var uploads = {};

// set your env variable CLOUDINARY_URL or set the following configuration
/* cloudinary.config({
cloud_name: '',
api_key: '',
api_secret: ''
}); */

console.log("** ** ** ** ** ** ** ** ** Uploads ** ** ** ** ** ** ** ** ** **");

// File upload
cloudinary.v2.uploader.upload('pizza.jpg', { tags: 'basic_sample' }, function (err, image) {
console.log();
console.log("** File Upload");
if (err) { console.warn(err); }
console.log("* public_id for the uploaded image is generated by Cloudinary's service.");
console.log("* " + image.public_id);
console.log("* " + image.url);
waitForAllUploads("pizza", err, image);
});
6 changes: 3 additions & 3 deletions controller/download/download_img.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class DownLoad {
//mke folder of given genre
let FS_MKDIR = util.promisify(fs.mkdir);
try{
await FS_MKDIR(path.join("/home/utsav/Desktop", genre))
await FS_MKDIR(path.join("C:/Users/shubham/Desktop/", genre))
.then((user) => {
console.log('Directory created successfully!')
})
Expand All @@ -31,7 +31,7 @@ class DownLoad {

let FS_WRITEFILE = util.promisify(fs.writeFile);
try{
await FS_WRITEFILE(path.join("/home/utsav/Desktop/"+genre,img_name), img_buffer,"base64")
await FS_WRITEFILE(path.join("C:/Users/shubham/Desktop/"+genre,img_name), img_buffer,"base64")
.then(() => {
// console.log('file saved to ', img_name)
})
Expand All @@ -43,7 +43,7 @@ class DownLoad {
}

handleRequest(req, res) {
// console.log(req)
console.log(req)
const user_id = req.params.user_id;
const genreList = req.params.genres.split(',');
console.log(user_id,genreList);
Expand Down
2 changes: 1 addition & 1 deletion controller/image/addImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class AddImage {
// console.log(user);

let features = await get_features(element.path);
let feature_list = features.slice(0,5);
let feature_list = features.slice(0,10);
await this.getStuff(element.path).then(async(data)=>{

let image_mapping = user[0].image;
Expand Down
113 changes: 113 additions & 0 deletions frontend/public/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,117 @@

}


.gallery-img {
width:100%;
height:50%;
object-fit: contain;
margin:8px;
box-shadow: 0 2px 5px 0 rgba(0,0,0,0.16), 0 2px 10px 0 rgba(0,0,0,0.12);
}


.search {
width: 30rem;
margin: 10rem auto 2rem auto;
text-align: right;
position: relative;
}
.search-box {
border: 4px solid transparent;
border-radius: 2px;
font-size: 2rem;
width: 100%;
padding: 1rem;
transition: width 0.3s;
}
.search-box:focus {
width: 100%;
outline: none;
border: 4px solid blue;
}
.search-btn {
height: 100%;
width: 4em;
margin-top: -2em;
position: absolute;
top: 50%;
right: 0.5rem;

opacity: 0.2;
background-color: transparent;
border: 0;
background-repeat: no-repeat;
background-size: 100%;

}
.search-btn:hover {
outline: none;
opacity: 0.4;
cursor: pointer;
}
.search-btn:focus {
outline: none;
opacity: 0.6;
}

ul.options {
position: absolute;
top: 80%;
width: 25%;
z-index: 1000;
padding: .5rem 0;
margin: .125rem 0 0;
font-size: 1rem;
color: #212529;
text-align: left;
list-style: none;
background-color: #fff;
background-clip: padding-box;
border: 1px solid rgba(0,0,0,.15);
border-top-color: rgba(0, 0, 0, 0.15);
border-top-style: solid;
border-top-width: 1px;
border-right-color: rgba(0, 0, 0, 0.15);
border-right-style: solid;
border-right-width: 1px;
border-bottom-color: rgba(0, 0, 0, 0.15);
border-bottom-style: solid;
border-bottom-width: 1px;
border-left-color: rgba(0, 0, 0, 0.15);
border-left-style: solid;
border-left-width: 1px;
border-image-source: initial;
border-image-slice: initial;
border-image-width: initial;
border-image-outset: initial;
border-image-repeat: initial;
border-radius: .25rem;
}

ul.options li {
display: block;
background: white;
font-size: 1.2rem;
width: 100%;
border-radius: 2px;
padding-left: 20px;
}
ul.options li:hover {
font-weight: bold;
color: blue;
cursor: pointer;
transition: 0.3s all;
}

ul.options li.option-active {
background: whitesmoke;
font-size: 1.5rem;
color: blue;
}
.no-options {
color: #000000;
}



6 changes: 3 additions & 3 deletions frontend/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Material Design Bootstrap -->
<!-- Your custom styles (optional) -->
<link href="css/style.min.css" rel="stylesheet">
<!-- <link href="css/style.min.css" rel="stylesheet"> -->
<link href="css/custom.css" rel="stylesheet">
<link href="css/mdb.lite.min.css" rel="stylesheet">
<link href="css/mdb.min.css" rel="stylesheet">
<!-- <link href="css/mdb.lite.min.css" rel="stylesheet"> -->
<!-- <link href="css/mdb.min.css" rel="stylesheet"> -->


<style>
Expand Down
5 changes: 2 additions & 3 deletions frontend/src/components/ImageTable/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from "react";


import "./style.css";

export default function ImageTable({ images, currentPage, pageSize, genre }) {
// console.log("genreimages");
Expand All @@ -14,14 +13,14 @@ export default function ImageTable({ images, currentPage, pageSize, genre }) {
// console.log("images present in image table ");
// console.log(currentImages);
return (
<div className="row">
<div className="row row-eq-height">
{!!images &&
currentImages.map((image) => {
const encodedImage = new Buffer(image.img_buffer, "binary").toString(
"base64"
);
const coverImage = "data:image/jpeg;base64," + encodedImage;
return( <div className="col-4 ">
return( <div className="col-4 ">
<img src={coverImage} className="gallery-img" alt={"cover"} />
</div>

Expand Down
21 changes: 7 additions & 14 deletions frontend/src/components/ImageTable/style.css
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
.img-grid {
/* .img-grid {
display: grid;
grid-auto-flow: row;
grid-template-columns: repeat(4, 1fr);
/* grid-row-gap: 20px; */
grid-row-gap: 20px;
grid-column-gap: 16px;
justify-items: center;
}
.gallery-img {
max-width:100%;
height:auto;
object-fit: contain;
margin:8px;
box-shadow: 0 2px 5px 0 rgba(0,0,0,0.16), 0 2px 10px 0 rgba(0,0,0,0.12);
}
.card-container {
position: relative;
Expand Down Expand Up @@ -53,9 +46,9 @@
width: 100%;
height: 56%;
/* border-radius: 25px; */
}
/* } */

.front > span {
/* .front > span {
position: absolute;
display: block;
color: white;
Expand All @@ -80,7 +73,7 @@
right: 0;
height: 134px;
background: #1e1b26;
}
} */

/* .card-footer > .trailer-btn,
i {
Expand Down Expand Up @@ -129,12 +122,12 @@
color: white;
} */

.card-footer > p {
/* .card-footer > p {
text-align: left;
font-weight: 100;
font-size: 11px;
color: rgb(255, 255, 255);
}
} */



4 changes: 2 additions & 2 deletions frontend/src/components/common/ListGroup/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react';
import "./style.css";


function resolveAll(options,onChange){
if(options){
return(
<div>
{/* <button class="button button5"><i class ="fas fa-button"></i></button> */}

<div key = {"all"} className="p-2 bd-highlight "><button type="button" className={"btn btn-outline-info btn-rounded waves-effect"}
onClick = {()=> onChange ("All")}>{"All"}</button>
</div>
Expand Down
Loading

0 comments on commit aca14fe

Please sign in to comment.