narges
narges

Reputation: 751

Show image in bootstrap upload image with jquery

I use bootstrap image upload. I want to show an default image in preview with JQuery and if user dont browse any image, that image was uploaded. How can i do it?

Upvotes: 1

Views: 1390

Answers (1)

z.gomar
z.gomar

Reputation: 370

you can use http://plugins.krajee.com/file-advanced-usage-demo.

 $("#input-24").fileinput({
        initialPreview: [
            'http://upload.wikimedia.org/wikipedia/commons/thumb/e/e1/FullMoon2010.jpg/631px-FullMoon2010.jpg',
            'http://upload.wikimedia.org/wikipedia/commons/thumb/6/6f/Earth_Eastern_Hemisphere.jpg/600px-Earth_Eastern_Hemisphere.jpg'
        ],
        initialPreviewAsData: true,
        initialPreviewConfig: [
            {caption: "Moon.jpg", size: 930321, width: "120px", key: 1},
            {caption: "Earth.jpg", size: 1218822, width: "120px", key: 2}
        ],
        deleteUrl: "/site/file-delete",
        overwriteInitial: false,
        maxFileSize: 100,
        initialCaption: "The Moon and the Earth"
    });

Upvotes: 1

Related Questions