Navigation

    Vietnam

    Nodejs.vn

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Tags
    • Groups
    • Search
    1. Home
    2. Vũ Đỗ
    V
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Vũ Đỗ

    @Vũ Đỗ

    2
    Reputation
    3
    Posts
    149
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    Vũ Đỗ Follow

    Best posts made by Vũ Đỗ

    • RE: Hiệu thời gian Javascript
      exports.showTime=function(n){
      				var date=new Date(n);
      
      					var v='';
      
      				    var seconds = Math.floor((new Date() - date) / 1000);
      
      				    var interval = Math.floor(seconds / 31536000);
      
      				    if (interval > 1) {
      				        v= interval + " năm trước";
      				         
      				         return v ;
      				    }
      				    interval = Math.floor(seconds / 2592000);
      				    if (interval > 1) {
      				         v= interval + " tháng trước";
      				          
      				         return v;
      				    }
      				    interval = Math.floor(seconds / 86400);
      				    if (interval > 1) {
      				         v= interval + " ngày trước";
      				          
      				         return v;
      				    }
      				    interval = Math.floor(seconds / 3600);
      				    if (interval > 1) {
      				         v= interval + " giờ trước ";
      				          
      				         return v;
      				    }
      				    interval = Math.floor(seconds / 60);
      				    if (interval > 1) {
      				         v= interval + " phút trước";
      				        
      				         return v ;
      				    }
      				     v= Math.floor(seconds) + " giây trước";
      
      					return v;
      			}
      
      posted in Hỏi Đáp
      V
      Vũ Đỗ
    • RE: Cho mình hỏi cách tích hợp thanh toán online như Ngân Lượng, Bảo Kim, VTC pay...vào webiste với ạ (nodejs+express+mongodb...)

      https://github.com/naustudio/node-vn-payments

      posted in Hỏi Đáp
      V
      Vũ Đỗ

    Latest posts made by Vũ Đỗ

    • RE: Hiệu thời gian Javascript
      exports.showTime=function(n){
      				var date=new Date(n);
      
      					var v='';
      
      				    var seconds = Math.floor((new Date() - date) / 1000);
      
      				    var interval = Math.floor(seconds / 31536000);
      
      				    if (interval > 1) {
      				        v= interval + " năm trước";
      				         
      				         return v ;
      				    }
      				    interval = Math.floor(seconds / 2592000);
      				    if (interval > 1) {
      				         v= interval + " tháng trước";
      				          
      				         return v;
      				    }
      				    interval = Math.floor(seconds / 86400);
      				    if (interval > 1) {
      				         v= interval + " ngày trước";
      				          
      				         return v;
      				    }
      				    interval = Math.floor(seconds / 3600);
      				    if (interval > 1) {
      				         v= interval + " giờ trước ";
      				          
      				         return v;
      				    }
      				    interval = Math.floor(seconds / 60);
      				    if (interval > 1) {
      				         v= interval + " phút trước";
      				        
      				         return v ;
      				    }
      				     v= Math.floor(seconds) + " giây trước";
      
      					return v;
      			}
      
      posted in Hỏi Đáp
      V
      Vũ Đỗ
    • RE: Cho mình hỏi cách tích hợp thanh toán online như Ngân Lượng, Bảo Kim, VTC pay...vào webiste với ạ (nodejs+express+mongodb...)

      https://github.com/naustudio/node-vn-payments

      posted in Hỏi Đáp
      V
      Vũ Đỗ
    • Giúp đỡ về crop image (easyimage)

      mình crop image dưới local thì chạy bthg. nhưng khi đưa lên server thì k crop được. chỉ nhận được file hình gốc ( vd: folder product có 1 hình chính, 1 folder small, 1 folder thumb. mà small vs thum lại k nhận hình). Anh/chị giúp em với.

      exports.resize=function(T_src,T_dis,T_width,T_height){

      var easyimg = require('easyimage');
      easyimg.resize({
      	     src:T_src, dst:T_dis,
      	     width:T_width, height:T_height,
      	     cropwidth:128, cropheight:128,
      	     x:0, y:0
      	  }).then(
      	  function(image) {
      	     console.log('Resized and cropped: ' + image.width + ' x ' + image.height);
      	     // console.log(image);
      
      	  },
      	  function (err) {
      	  	throw err;
      	    console.log(err);
      	  }
      	);
      

      }
      exports.uploadFile=function(file,name_picture,path = __dirname+'../public/upload/', pathImg = '/public/upload'){
      var fs=require("fs");
      var originalFilename = file.name;
      var fileType = file.type.split('/')[1];
      var fileSize = file.size;
      var pathUpload = path + name_picture;
      var pathImg = pathImg + originalFilename;
      var data = fs.readFileSync(file.path);
      fs.writeFileSync(pathUpload, data);
      var imgUrl = '';
      if( fs.existsSync(pathUpload) ) {
      imgUrl = pathImg;

          this.resize(pathUpload,path + "small/" + name_picture,100,100);
          this.resize(pathUpload,path + "thumb/" + name_picture,250,250);
      }
      return imgUrl;
      

      }

      posted in ExpressJS/Conect.IO
      V
      Vũ Đỗ