I'm using shadowbox to display media based on URLs from a database.
Some of the media are images and some are websites and some are flash movies
I wish to check if an image contains "http://" meaning it's a website (all images and flvs start with "media/"), and if it does contain http:// then I wish to display it at a different size.
I've tried using strpos() to check if http:// is part of the string but for some reason I'm having difficulty getting it to display correctly.
Here is a sample of my code:
$first = 0;
$iQuery = mysql_query("SELECT * from media WHERE project='$projectTitle' ORDER BY weight ASC");
while($irow = mysql_fetch_array($iQuery)){
$mediaLink = $irow['link'];
//produce photostream
$contains = strpos($mediaLink, "http://");
if($contains === false){
if($first==0){
$photostream .= "<a href=\"$imageLink\" rel=\"shadowbox[$projectTitle];width=919;height=538\" onmouseover=\"tooltip.show('$tooltip');\" onmouseout=\"tooltip.hide();\"><img src=\"$projectThumb\" width=\"109px\" height=\"109px\"></a>";
} else {
$photostream .= "<a href=\"$imageLink\" rel=\"shadowbox[$projectTitle];width=919;height=538\"></a>";
}
$first++;
}else{
if($first==0){
$photostream .= "<a href=\"$imageLink\" rel=\"shadowbox[$projectTitle];width=1024;height=768\" onmouseover=\"tooltip.show('$tooltip');\" onmouseout=\"tooltip.hide();\"><img src=\"$projectThumb\" width=\"109px\" height=\"109px\"></a>";
} else {
$photostream .= "<a href=\"$imageLink\" rel=\"shadowbox[$projectTitle];width=1024;height=768\"></a>";
}
$first++;
}
In theory, my code should check to see if the string contains http:// (if it does it'll return 0, if it doesn't it should return false), and then manipulate my photo-stream as appropriate but frustratingly doesn't output ANY of the photo-stream if it's detected.
Cheers for any help you can offer. Dan