...

View Full Version : Random Images - More complex than it appears



Skuall
04-18-2004, 08:40 PM
Hello!

My problem is very simple... I don't know how this is made...

http://cristiano.galdino.net/avatar.png

For sure, you can say )... It's only an image... No! (If you are prompted to save the image, do this!) Refresh the page now... It's changes the image... PNG can't do this! It's PHP (One of the images, show the actual date/time - PHP, obvious!)

Someone know how to do this effect? (Detail: The extension of the file, is .png, not .php, how was expected)

Thank You!

raf
04-18-2004, 10:07 PM
3 tips:

always search the manual : http://www.php.net/manual/en/ref.image.php
always run a search on google or another searchengine (therer should be a few zilion links on "PHP Images"
always use the searchfunction in this forum. There have been numerous threads about creating/manipulating image with PHP

Len Whistler
04-18-2004, 10:17 PM
png is an image file, like .jpg or .gif

Below is a php code I use to change an image every 10 seconds. I have 6 images that display according to the seconds of the server. Another method is the random (rand) number function with php.



<?php

$n = date('s');


if ($n < 10) {
echo '<table><tr><td><img border="2" src="images/banner/01.jpg"
width="346" height="150" alt = "image 1 of 6"></td></tr></table>';
}

elseif ($n < 20 ) {
echo '<table><tr><td><img border="2" src="images/banner/02.jpg"
width="155" height="150" alt = "image 2 of 6"></td></tr></table>';
}

elseif ($n < 30 ) {
echo '<table><tr><td><img border="2" src="images/banner/03.jpg"
width="305" height="150" alt = "image 3 of 6"></td></tr></table>';
}

elseif ($n < 40 ) {
echo '<table><tr><td><img border="2" src="images/banner/04.jpg"
width="412" height="150" alt = "image 4 of 6"></td></tr></table>';
}

elseif ($n < 50 ) {
echo '<table><tr><td><img border="2" src="images/banner/05.jpg"
width="365" height="150" alt = "image 5 of 6"></td></tr></table>';
}

else {
echo '<table><tr><td><img src="images/banner/canada.gif"
alt = "Canadian flag - 1967"></td></tr></table>';
}


?>

Leonard Whistler
www.stubby.ca

Skuall
04-19-2004, 12:14 AM
3 tips:

always search the manual : http://www.php.net/manual/en/ref.image.php
always run a search on google or another searchengine (therer should be a few zilion links on "PHP Images"
always use the searchfunction in this forum. There have been numerous threads about creating/manipulating image with PHP

1 tip:

Read carefully what someone just wrote...

To create an image, with an file .php its easy, guy! But, my problem, is how to do this, with one file .png... understood?

raf
04-19-2004, 01:08 AM
1 tip:

Read carefully what someone just wrote...

To create an image, with an file .php its easy, guy! But, my problem, is how to do this, with one file .png... understood?
Hahahahahahahaaaah.

Oh man. I suppose every now and then one of these needs to come along here :rolleyes: .

Anyway, if you'd bother to explain what you need, in a few understandable sentences instead of posting a link to an image, then maybe, just maybe, you could get better help.
There are dozens of ways to dynamically create PNG's from text, gifs or whatever other content, and the page in the manual I linked to, even contains examplecode and all the info you need to do so. Dozens of others could be found within minutes with every searchengine.

But i suppose i'm just to stupid to understand what extra-specials you need (or maybe , just maybe, your explanation could be clearer --> if you would just know what to ask for, that is).

But don't worry ! Maybe someone who's better at mindreading, or that appreciates your style and attitude a bit more, or that is simply not as stupid as I am (it's genetic, sorry) will come along and spell it out for you.

Skuall
04-19-2004, 01:26 AM
Hahahahahahahaaaah.

Oh man. I suppose every now and then one of these needs to come along here :rolleyes: .

Anyway, if you'd bother to explain what you need, in a few understandable sentences instead of posting a link to an image, then maybe, just maybe, you could get better help.
There are dozens of ways to dynamically create PNG's from text, gifs or whatever other content, and the page in the manual I linked to, even contains examplecode and all the info you need to do so. Dozens of others could be found within minutes with every searchengine.

But i suppose i'm just to stupid to understand what extra-specials you need (or maybe , just maybe, your explanation could be clearer --> if you would just know what to ask for, that is).

But don't worry ! Maybe someone who's better at mindreading, or that appreciates your style and attitude a bit more, or that is simply not as stupid as I am (it's genetic, sorry) will come along and spell it out for you.


Well... "One image is better than thousand words"... Isn't true anymore?

Sorry if you can't understand what I'm saying... If you didn't saw, I'm not English... I speak Portuguese... maybe this turn the things a little bit more hard to understand...

MindReader? It's obvious what I want... How to generate random images, with a file like: "image.png". There are PHP on it... But how I mix then?

I've send the exactly same message at phpfreaks forum and have response that I'm expected... Interpretation may vary...

Thank you for helping me.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum