MyBB Community Forums

Full Version: PHP Signature Rotator with Links
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I also posted this on SupportForums (http://www.supportforums.net/showthread.php?tid=8120), but I thought I might receive a faster reply here.

Quote:Hello,

I am in need of a PHP signature rotator, with links.

So, for example, if I have two signatures in the script, each time I reload the script, it displays a signature (image) with a link attached to the image.

I need it so it'll work on a MyBB forum with the image tag. [img][/img]

I was thinking of using the PHP dynamic image, but not sure how I would incorporate an array with different image links with URLs attached to them.

Please let me know if I need to explain more.

Thanks in advance.
http://www.marcofolio.net/webdesign/php_...ation.html

Just do [img]domain.com/rotator/index.php[/img]
Ok, but how would I make it so it takes images from an array, as-well as the links that go with each image in the same array, and make it into a PHP generated image?
HTMP, PHP, Javascript, or Flash... none of which are supported in signatures with HTML disabled. The actual link comes from the [URL] tags surrounding the [IMG] tags.
I found this script...

<?php
     $dir = './';
     $images = array(
          array('yourimage1.jpg', 'image/jpg', 'http://link', 'alt', 'title'),
          array('anotherimage.jpg', 'image/jpg', 'http://link', 'alt', 'title'),
          array('yetanotherimage.gif', 'image/gif', 'http://link', 'alt', 'title'),
          array('thelastimage.png', 'image/png', 'http://link', 'alt', 'title')
     );

     $rand = mt_rand(0,(sizeof($images) - 1));
     $filename = $images[$rand][0];
     $mime_type = $images[$rand][1];
     $link = $images[$rand][2];
     $alt = $images[$rand][3];
     $title = $images[$rand][4];
     $file_path = $dir . $filename;

     header('Last-Modified: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 31536000));
     header('ETag: "' . $etag . '"');
     header('Accept-Ranges: bytes');
     if ($size)
          header('Content-Length: ' . $size);

    header('Content-Type: ' . $mime_type);

     if (file_exists($link))
          echo '<a href="' . $link . '"><img src="' . $image . '" alt="' . $alt . '" title="' . $title . '" /></a>';
?>

from here :p
(2010-07-03, 03:12 AM)darkly Wrote: [ -> ]I found this script...

<?php
     $dir = './';
     $images = array(
          array('yourimage1.jpg', 'image/jpg', 'http://link', 'alt', 'title'),
          array('anotherimage.jpg', 'image/jpg', 'http://link', 'alt', 'title'),
          array('yetanotherimage.gif', 'image/gif', 'http://link', 'alt', 'title'),
          array('thelastimage.png', 'image/png', 'http://link', 'alt', 'title')
     );

     $rand = mt_rand(0,(sizeof($images) - 1));
     $filename = $images[$rand][0];
     $mime_type = $images[$rand][1];
     $link = $images[$rand][2];
     $alt = $images[$rand][3];
     $title = $images[$rand][4];
     $file_path = $dir . $filename;

     header('Last-Modified: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 31536000));
     header('ETag: "' . $etag . '"');
     header('Accept-Ranges: bytes');
     if ($size)
          header('Content-Length: ' . $size);

    header('Content-Type: ' . $mime_type);

     if (file_exists($link))
          echo '<a href="' . $link . '"><img src="' . $image . '" alt="' . $alt . '" title="' . $title . '" /></a>';
?>

from here :p

This is what I'm looking for, but I want it so it'll use the PHP GD library, so it will display the images (with their corresponding links) in a MyBB [img] tag.
put simply, you cant... Without some HTML/JAVA/PHP in the signiture on the MyBB forum end, you can have dynamic links along with images. You could have a link to a page that redirected you to a random page, or an image, but not both.

To use GD library you need to send out a
header ("Content-type: image/xxx");
(replacing xxx with the content type (png,jpg,gif etc...))

However to reidrect you need to:
header ('Location: http://blah.com');
and you cant send those 2 headers, it wont work...