- pathinfo: documentation ( source)
- strpos: documentation ( source)
<?php
function isTribune($imagePath){
return strpos($imagePath,'tmsimg.com') !== false;
}
/*
function makePath($imagePath) {
if(!isTribune($imagePath) {
return false;
}
}
*/
$basePath = "images/bin/channels/";
$noImageNegative = "images/bin/channels/nochan_neg.png";
$noImageTribune = "http://aiotv.tmsimg.com/sources/generic/generic_sources_h3.png";
$path = "http://aiotv.tmsimg.com/sources/h3/NowShowing/21633/s21633_h3_aa.png";
if($path == $noImageTribune){
$newPath = $noImageNegative;
} else {
$fileName = pathinfo($path,PATHINFO_FILENAME);
$negName = $fileName . "_neg.png";
$newPath = $basePath . $negName;
}
print $newPath;