- pathinfo: documentation ( source)
<?php
$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;