PHP код не выполняется ,не работает в браузере
<?php
$rando = AdvertPhoto::model()->findByAttributes($attributes,array('order'=>'id DESC'));
$bye= $rando->advert_id;
foreach(AdvertPhoto::model()->findAllByAttributes(array('advert_id' => $bye)) as $subcategory):
// echo $subcategory->id." | ".$subcategory->advert_id." | ".$subcategory->filename;
$gde = $_SERVER['DOCUMENT_ROOT'];
$fotkas= $gde.Yii::app()->params["media_path"].'/uploads/'.$subcategory->filename;
$fotka = realpath(str_replace('/', '\\', $fotkas));
$fs = getimagesize($fotka);
$wfs = $fs[0];
$hfs= $fs[1];
// echo "width: ". $wfs ." px | height: " . $hfs . " px<br>";
echo $fotka. '<br>';
$nfs = 400;
if($wfs <= $nfs && $hfs <= $nfs):
// echo "<br> paveikslelis tinkamo didzio";
else:
if($wfs > $hfs):
$rfs=floatval($wfs/$hfs);
$nwfs1=$wfs-$nfs;
$nwfs=$wfs-$nwfs1;
$nhfs=round(floatval($nwfs/$rfs));
else:
$rfs=floatval($hfs/$wfs);
$nhfs1=$hfs-$nfs;
$nhfs=$hfs-$nhfs1;
$nwfs=round(floatval($nhfs/$rfs));
endif;
include_once(realpath(str_replace('/', '\\', $gde.Yii::app()->params["media_path"].'/'.'protected/components/classSimpleImage.php')));
$image = new SimpleImage();
$image->load($fotka);
$image->resize($nwfs, $nhfs);
$image->save($fotka);
// echo $fotka;
// echo "<br>konvertuotas ".$nwfs." | ".$nhfs;
endif;
endforeach; ?>