keystonejs / keystone-classic

Node.js CMS and web app framework
http://v4.keystonejs.com
MIT License
14.64k stars 2.21k forks source link

keystonejs 4 beta file system storage adapter image preview #3781

Open freew01f opened 7 years ago

freew01f commented 7 years ago

I want preview the upload file that is image

Gallery.add({
    name: { type: String, required: true },
    publishedDate: { type: Date, default: Date.now },
    image: { 
        type: Types.File, 
        storage: storage,
        format: function(item, file){
            return '<pre>'+JSON.stringify(file, false, 2)+'</pre>'+
                '<img src="'+file.url+'" style="max-width: 300px">'
        }
    },
});

I think i can not use the format function , because it is old function for ver 3 how can i do it

djjandyhl commented 7 years ago

I have the same question.....

freew01f commented 7 years ago

this version is not finished I think the author need time update the storage adapter

piermariacosina commented 7 years ago

no news on this?

goldcome commented 7 years ago

I want to know , are there any examples

bi-kim commented 6 years ago

'format' is a feature under development, looking for the following types of output methods?

//model

Gallery.schema.virtual('preview').get(function () {
    return 'img width="300" height="300" src=\"/images/' + this.images.filename +'\"';
});

//view

each gallery in galleries
 ... #{gallery.preview}