Closed Thread Icon

Topic awaiting preservation: detect image type Pages that link to <a href="https://ozoneasylum.com/backlink?for=12235" title="Pages that link to Topic awaiting preservation: detect image type" rel="nofollow" >Topic awaiting preservation: detect image type\

 
Author Thread
Wakkos
Maniac (V) Mad Scientist

From: Azylum's Secret Lab
Insane since: Oct 2000

posted posted 05-26-2002 11:05

There's a way to detect the image file from an URL
I have the variable

$url = 'http://www.xxx.com/image.gif'

or

$url = 'http://www.xxx.com/image.jpg'

Can I detect if the image is a GIF or a JPG?

Thanks in advance, i don't find anything about that...

A sig should be here.....
But is not.

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 05-26-2002 11:25

<?php

$url = 'http://www.xxx.com/image.gif';
$ext = strtolower(substr(strrchr($url, "."), 1));
switch ($ext)
{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case "gif":
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print "Image Type is GIF";
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case "jpg":
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print "Image Type is JPG";
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;
}

?>

Enjoy!


InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 05-26-2002 11:29

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

Wakkos
Maniac (V) Mad Scientist

From: Azylum's Secret Lab
Insane since: Oct 2000

posted posted 05-26-2002 11:32

Cool!!
I found this, (given by Weadz):

code:
$tempo ='anyname';
if(ereg("\.gif$",$url)) {
$save = '/usr/www/htdocs/artreves/robadas/temp/'.$tempo.'.gif';
}
else {
$save = '/usr/www/htdocs/artreves/robadas/temp/'.$tempo.'.jpg';
}

Wakkos
Maniac (V) Mad Scientist

From: Azylum's Secret Lab
Insane since: Oct 2000

posted posted 05-26-2002 11:35

Oh!! hehe, you're faster than me posting guys!

I'll try all the scripts to see how they work!

The one that i posted works right!

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 05-26-2002 11:36

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

Wakkos
Maniac (V) Mad Scientist

From: Azylum's Secret Lab
Insane since: Oct 2000

posted posted 05-26-2002 11:38

If I'm not wrong, bitdamaged, to check the first bit, i would do it with the exif_imagetype thing?


mr.maX script worked good too, that one is good because with the case thing, i can detect more than just jpg or gif files.....

Wakkos
Maniac (V) Mad Scientist

From: Azylum's Secret Lab
Insane since: Oct 2000

posted posted 05-26-2002 11:41

I could do the following ini:

code:
if(ereg("\.gif$",$filename)) // Look for .gif extension
{
$save = '/usr/www/htdocs/artreves/robadas/temp/'.$tempo.'.gif';
}
elseif(ereg("\.jpe?g",$filename)) // Look for .jpg or .jpeg
{
$save = '/usr/www/htdocs/artreves/robadas/temp/'.$tempo.'.jpg';
}
else // not a GIF or JPG file
{
return("Hey asshole! not .exe files here!");
}



Would work better?

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 05-26-2002 11:54

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

Wakkos
Maniac (V) Mad Scientist

From: Azylum's Secret Lab
Insane since: Oct 2000

posted posted 05-26-2002 12:01

Hey! way too cool!

Checking fopen() right now!

And i dunno why, i thought that the second post was posted by Bitdamaged , too much coffee this morning!

Daniel? How the hell did you know that?
it's not a secret, but i'm surprised somebody here calling me other than Wakkos... =D
Edit: Of course! the Ps POng!

[This message has been edited by Wakkos (edited 05-26-2002).]

« BackwardsOnwards »

Show Forum Drop Down Menu