evanct Posted June 5, 2009 Share Posted June 5, 2009 Simple but confusing problem: I have this constant defined in config.php: define('MAX_IMAGE_SIZE',350); And part of this function that uses it: require_once('config.php'); list($width,$height)=getimagesize($path); $left_margin=(MAX_IMAGE_SIZE - $width) / 2 .'px;'; MAX_IMAGE_SIZE isn't recognized for some reason. it's just treated as 0. the require_once filepath is correct. MAX_IMAGE_SIZE is used successfully in other scripts. have any ideas why this might happen? Link to comment https://forums.phpfreaks.com/topic/161128-solved-constant-not-getting-read/ Share on other sites More sharing options...
wgoldschagg Posted June 5, 2009 Share Posted June 5, 2009 its possible that your config.php isnt set up properly. Link to comment https://forums.phpfreaks.com/topic/161128-solved-constant-not-getting-read/#findComment-850285 Share on other sites More sharing options...
evanct Posted June 5, 2009 Author Share Posted June 5, 2009 I got it, it seems the require_once path had to be relative to the script that was calling the function that used MAX_IMAGE_SIZE - not to the script that contained that function. seems counterintuitive to me, but oh well. Link to comment https://forums.phpfreaks.com/topic/161128-solved-constant-not-getting-read/#findComment-850297 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.