|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
images
okay here's a stumper.. i want to be able to define whether or not an image exists, but NOT on my server. for example, if i am writing a script that would allow people to have their own icons (url to their own image) and if that image is dead then i want to replace it with my own image that says "this image is dead" or something like that.
any idea's how to achieve this? cause PHP won't read any image data for a file on an outside server as far as i can tell. plzkthx! |
|
#2
|
|||
|
|||
|
RE: images
|
|
#3
|
|||
|
|||
|
RE: images
if (getimagesize("http://www.server.com/images/image.gif")==NULL) {
echo "Bad image"; } else { echo "Image OK."; } Check out http://www.php.net/manual/en/function.getimagesize.php for more info. |
|
#4
|
|||
|
|||
|
Code font
How do you get the font size smaller for your code in the posting above Matt ?
|
|
#5
|
|||
|
|||
|
RE: images
what the crap.. you guys make it so simple *cries* THX! although i can't actually try it until i get home but i'm sure it works
and svein, put your code inbetween tags: [ C O D E ] my code [ / C O D E ] no spaces |
|
#6
|
|||
|
|||
|
RE: images
okay more help plz it's not quite working.. when i use the "readfile" it literally reads the file, and prints the garbage code on the screen even if i suppress error messages. not only that, it ignores the "if" statements it will either print the image or not from the "readfile" command alone but i don't even want it to print the image :-/
also is there a way to copy someones file from their own server to my own? |
|
#7
|
|||
|
|||
|
RE: images
|
|
#8
|
|||
|
|||
|
RE: images
you're awsome matt $ svein, thank you
|
|
#9
|
|||
|
|||
|
RE: images
i'm noticing.. ya know how some images when dead will take a while to load? well when trying to execute a script using this dead img filter thing (discussed above), sometimes the script will just time out. how might i set a time limit on how long a certain function should attempt to execute before just continuing along with the rest of the script?
|
|
#10
|
|||
|
|||
|
RE: images
That timeout value is probably dictated by the server that you are trying to read the file off.
If you were to try fopen on the url, you would either get back nothing after a while, or you would get back a 404 error page instead of the image. Not sure if that bypasses the timeout or not though. |
|
#11
|
|||
|
|||
|
RE: images
To avoid this kind of timeout, I think I'd rather use client-side scripting (javascript). Instead of generating <img> tags, generate js code to check for the picture.
Ask me if U want more info, I don't have much time |
|
#12
|
|||
|
|||
|
RE: images
i would be interested in seeing the javascript code for something like that..
and also, i've got a problem that i'm sure has a simple solution but i just can't see it.. i need to create a loop, that loops 6 times, and prints a table of configurable rows and columns. right now i have it set into 2 loops, the first for rows and the second for columns, but that interferes with my wanting to insert seperate data into each table cell without the data repeating itself.. i'm calling for the data from a text file db so.. help on this too would be appreciated |
|
#13
|
|||
|
|||
|
RE: images
isnt that where you just put LIMIT 0,6 at the end of the SQL query?
|
|
#14
|
|||
|
|||
|
RE: images
i don't use SQL.. i'm still on flatfile db's.. and PS ignore my above problem with the tables.
|
|
#15
|
|||
|
|||
|
RE: images
|