Create Automatic Barcode with Image while creating items

I want barcode to be automatically created with images while creating items. I have gone through some of the js codes provided in discussion forum but there’s not the proper way so that i can setup.

Anyone can please provide me a clear way to automatically create barcode images.