www.webdeveloper.com
Results 1 to 6 of 6

Thread: Script to Display Ads Next to Images Opened in New Window

  1. #1
    Join Date
    Jul 2012
    Posts
    3

    Script to Display Ads Next to Images Opened in New Window

    Does anyone know if there's a script available to display ads next images opened in a new window.

    The application I'm thinking of is a website with lots of image content were the images are set to open in a new window, as below.

    <a target="_blank" href="http://www.website.com/images/picture.jpg" ><img src="http://www.website.com/images/thumb.jpg"></a>

    Is there a script available that would allow addtional content (e.g. ads, special messages, etc) to be displayed next to the images opened in the new window?

  2. #2
    Join Date
    Mar 2012
    Posts
    1,190
    Instead of linking to the image, create a web page containing the image and link to it. Then you can put whatever you like next to the image.

  3. #3
    Join Date
    Jul 2012
    Posts
    3
    jedaisoul - thanks for the reply. That would be fine for a new site but I'm looking for an efficient solution for a site that already has thousands of images!

    All the images are sitting in a subfolder /images/ and there's a huge amount of pageviews everyday that open in a new window. Just trying to see if there's a simple way to present some additional content alongside each image opened.

  4. #4
    Join Date
    Mar 2012
    Posts
    1,190
    Quote Originally Posted by bougatsa View Post
    jedaisoul - thanks for the reply. That would be fine for a new site but I'm looking for an efficient solution for a site that already has thousands of images!

    All the images are sitting in a subfolder /images/ and there's a huge amount of pageviews everyday that open in a new window. Just trying to see if there's a simple way to present some additional content alongside each image opened.
    Then use PHP. Pass the image name as a URL variable. Then you only have to write ONE "wrapper" page to display any image and the added content. I.e.

    The calling page(s) (which can still be HTML) contain:

    <a href="imagepage.php?image=picture.jpg" target="_blank"><img src="images/thumb.jpg"></a>

    The image page, (which will be PHP) contains something like:

    <img src="http://www.website.com/images/<?php echo $_GET['image']; ?>

    Note: It could be possible to use global replace to substitute the call to the PHP page for the direct calls of the images. E.g.
    replace: 'href="http://www.website.com/images/'
    with: 'href="imagepage.php?image='

    Is that a viable solution?

    P.S. Not sure why you are using absolute addressing for the images, but that is a separate issue.

  5. #5
    Join Date
    Jul 2012
    Posts
    3
    jedaisoul - excellent! That's a great idea and very efficient.

    The calling pages are blog posts (Wordpress) and the images are, as I said, in /images/ folder.

    I'm sure there's a plugin available that allows you to make global changes to links within Wordpress. Otherwise, I'm sure there must be a quick way to make the necessary changes in MySQL database.

    Nice one jedaisoul, very much appreciated

  6. #6
    Join Date
    Mar 2012
    Posts
    1,190
    Glad to be of service.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles