Forum Moderators: coopster
Any help appreciated!
We have a website which we are in the process of moving server, but we can't get it to run :-(
The error message states
"PHP Parse error: parse error, unexpected T_STRING in e:\domains\gallery2c.com\wwwroot\media.php on line 9"
The index.php code is
<?php
// $Id: index.php 168 2006-12-21 12:59:12Z david $
require_once '../lib/OrientationMapper.php';
require_once '../lib/ProductMapper.php';
require_once '../lib/ArtistMapper.php';
require_once '../lib/SubjectMapper.php';
require_once '../lib/Gallery.php';
$smarty = new Smarty_Gallery();
$artist = ArtistMapper::findFeaturedArtist();
if (is_object($artist)) {
$smarty->assign('artist', $artist);
}
$products = ProductMapper::findFeaturedProducts(1);
$featured = array();
$offset = 0;
foreach ($products as $product) {
$featured[$offset]['product'] = $product;
$featured[$offset]['artist'] = ArtistMapper::findArtist($product->artist);
$offset++;
}
$smarty->assign('featured', $featured);
$smarty->assign('tpl_name', 'home');
$smarty->assign('meta_title', 'photographers gallery bristol, photographic art bristol, image library bristol, picture gallery');
$smarty->assign('meta_desc', 'photographers gallery bristol, photographic art bristol, image library bristol, picture gallery, photographic pictures ');
$smarty->assign('meta_keys', 'photographers gallery bristol, photographic art bristol, image library bristol, picture gallery, photographic pictures');
$smarty->display('default.tpl');
?>
and the media.php code is:
<?php
// $Id: media.php 112 2006-12-15 09:11:10Z david $
require_once '../lib/ProductMapper.php';
$product = ProductMapper::findProduct($_GET['p']);
if (is_object($product) == false)
return;
$cache_file = 'media/cache/' . $_GET['p'] . $_GET['i'] . '.jpg';
$ctime = time();
$ftime = filectime($cache_file);
$dtime = $ctime - $ftime;
// Use the cache on 95% of occasions, where the file is newer than 24 hours old.
if (file_exists($cache_file) && rand(1, 100) > 95 && $dtime < 86400) {
header("Content-Type: image/jpeg");
readfile($cache_file);
} else {
switch ($_GET['i']) {
case "f":
$url = $product->image_featured;
++$product->impressions_b;
break;
case "n":
$url = $product->image_full;
++$product->impressions;
break;
case "t":
$url = $product->image_thumbnail;
++$product->impressions_c;
break;
}
ProductMapper::updateProduct($product);
if (isset($url)) {
$path = '../srv/uploads/photographs/';
if (file_exists($path . $url)) {
header("Content-Type: " . mime_content_type($path . $url));
$im_meta = getimagesize($path . $url);
if ($im_meta[2] == IMG_JPG) {
$im = imagecreatefromjpeg($path . $url);
imagejpeg($im, $cache_file);
imagejpeg($im);
} else {
readfile($path . $url);
}
}
}
}
?>
There are other php files too, any help appreciated. If I need to post more code please let me know!
Warm Regards,
Joel
[edited by: jatar_k at 12:46 pm (utc) on April 9, 2008]
[edit reason] no urls thanks [/edit]
so these lines
<?php
// $Id: media.php 112 2006-12-15 09:11:10Z david $
require_once '../lib/ProductMapper.php';
$product = ProductMapper::findProduct($_GET['p']);
if (is_object($product) == false)
return;
$cache_file = 'media/cache/' . $_GET['p'] . $_GET['i'] . '.jpg';
I can't see an error actually, anyone else?
I was just reading the docs and apparently you can use a return in a global scope to quite the script, which I never knew before! So I'm not sure if that the error or not.
[php.net...]
Andrew