Stay Connected  Follow abhisays on Twitter   Connect to abhisays on Facebook  

Last Updated: August 9, 2015  1,997 views

How to use Adsense with Coppermine Gallery?

in: Tips and Tricks

photogallery-coppermine.jpgThese days Photo Galleries have become integral part of big portals. There are many open source PHP scripts that you can use for integrating photo gallery with your website. For example, we have Gallery, Coppermine, 4Images etc. Out of these I prefer to use CopperMine Photo Gallery. It is the best Photo Gallery PHP script available on internet. For proper installation, it requires PHP, MySQL, and ImageMagick or the GD Graphics Library, and web server software such as Apache. It can be easily integrated with Coppermine Photo Gallery has interfaces with other popular content management systems like e107, Invision Power Board, Joomla!, Mambo, phpBB, PostNuke, PunBB, Simple Machines Forum, vBulletin, Woltlab Burning Board, and YaBB SE. It is an open-source software and is licensed under the GNU General Public License.

But for using coppermine, you must have to add a “Powered by Coppermine” link in your photo gallery. Overall, Coppermine Gallery is a good gallery software. It’s really easy to use, bug free and integrates easily to many popular open source forums. But it is not easy to customize its code, as layout and functions are not properly separated.

You can easily earn a good amount of money through using adsense in your photo gallery. Today I will tell you how to place google adsense codes in your Coppermine photo gallery.

1: Below Header


For adding 728×90 adsense ad just below the header, you have to find “{ADMIN_MENU}” in the template.html file of your Coppermine template. Then add this piece of code just after “{ADMIN_MENU}”.

<table width=”100%” border=”0″ align=”center” cellpadding=”0″ cellspacing=”0″>
<td align=”left” valign=”top”> {ADMIN_MENU}
<table width=”100%” border=”0″ align=”center” cellpadding=”25″ cellspacing=”0″>
<td align=”center” valign=”top”>
Your Google Adsense Code

2 : Adsense Ad around the image.


For adding adsense ads around images, you have to edit “” file. This file is located in “include” folder of the Coppermine directory.

// HTML template for intermediate image display
if (!isset($template_display_media)) { //{THEMES}
$template_display_media = <<<EOT
<td align=”center” class=”display_media” nowrap=”nowrap”>
<table cellspacing=”2″ cellpadding=”0″ class=”imageborder”>
<td align=”center”>Your Adsense Code</td>
<td align=”center”>{IMAGE}</td>
<td align=”center”>Your Adsense Code</td>

Find comment containing “intermediate image display”. Just compare the code with the code written above and add “<td align=”center”>Your Adsense Code</td>” just above and below “<td align=”center”>{IMAGE}</td>”.

So, in this way you can easily integrate Adsense with you Coppermine Photo Gallery and monetize your photo website. In case of any confusion, feel free to contact me.

To know more about Coppermine and to download it?visit

  • 1

    THANK YOU so much for this! I’ve been searching for a way to add adsense around images in my coppermine gallery and always came up empty. Thanks to you now I’ll be able to do what I wanted. Thanks

    Chris on September 13th, 2008
  • 2

    Thank you for that advice. I used it to put the StumbleUpon button at my page top.

    Midas on October 9th, 2008
  • 3

    I am new to php coding, and could not find anywhere that gave a tutorial on how to ad the google adsense to my coppermine gallery theme. This was perfect! I had to do a little moding of the code and now it is perfect and I have you to thank!!! ?? As soon as I get the new gallery online, stop by and see the results!

    Kaiya on October 10th, 2008
  • 4

    The adsense below the header didn’t work for me. When I just added by adsense code after {ADMIN_MENU} it worked but showed the banner on the left side. Then I tried with the code you published and it messed up my coppermine template. I think I’ll settle to just using the banner on the left side

    John on November 24th, 2008
  • 5

    Really many thanks! Finally i can ad adsense to my gallery! ??

    Marti on February 2nd, 2009
  • 6

    When I tried to add the 1. Below Header code, I too had problems. When I just added the code after {ADMIN MENU} I was able to get Google Ads to show. I just wanted to say Thanks as your information gave me enough to make this work.

    Pablo on February 22nd, 2009
  • 7

    Great Tutorial. Thanks.

    Zagao on April 3rd, 2009
  • 8

    Nice info. Thanks.
    But, can I use two adsense ads adjacent to photos? What about TOR?

    Xn on April 13th, 2009
  • 9

    Terms of Service I mean. The one that does not allow you to post photos adjacent to adsense

    Xn on April 13th, 2009
  • 10

    The second one doesn’t work. Please help me!

    injoon on September 27th, 2009
  • 11

    Thanks for the tutorial. Worked perfectly ?? My only slight concern is that it’s on what Google would consider to be non content pages (ie; the upload section/search etc), but I don’t think it will be too much of an issue. I’ll just remove if they ask me to.

    Julia on October 28th, 2009
  • 12

    Thanks a lot again buddy

    youbulb on November 4th, 2009
  • 13

    perfect dud….. thanks a million….

    Sanwal on December 11th, 2009
  • 14

    i love google Adsense, it enables me to earn money on the websites and forums that i have put up several years ago. if you got tons of websites, you can earn a lot from Adsense alone

    Karen Hayes on March 4th, 2010
  • 15

    thanks bro… ??

    admin on March 5th, 2010
  • 16

    Many thanks for this valuable help

    Kevin on May 31st, 2010
  • 17

    Thank you so much. I have dealt with coppermine for years but forgot the exact files to modify for ad placement. After sever unsuccessful attempts modifying the displayimage.php file, I found your site and also found the right files. Thanx.

    John on May 1st, 2012
  • 18

    thanks for this advisory and great article. I am trying to start a photo graphic website and this is really going to help me.
    Thank you again and Regards.

    Rajeev Joshi on January 7th, 2015