Is there a way how you can ad advertising to a .jpg file, like when a search done on the internet like a user clicks a thumb image and they get to domain.com/image.jpg with that I want ads like maybe banners or pop under
You mean like after a Google Image search? :) Sure, you could either add the advertising to each image and store the image or you could add it to the image on the fly using server-side image manipulation technologies. If you only wanted to serve up the images for certain sites, like a bot or search engine, you check the IP or referer.
Imagemagick offers an API that will work on any platform. Many server-side languages have support for the library built-in. There are other options like the GD library, which was an early option and widely used in PHP, but not quite as hearty as Imagemagick when it comes to manipulation.
OK I will start to say that im not that into coding, but my mission is that when users on google image click the direct link to my images I want some advertising added, like a few banners and a popunder, it must be a little pain for the user, so some will pick the other solution next time.
Maybe its even possible, when a user clicks that link hes redirected to another real page of mine, but I still want google to fetch my images, you never know if they change things again.