• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Call Image Path From Database

#6
[eluser]boltsabre[/eluser]
To save a little time coding, I created a few site wide variables, ($IMG_PATH, $CSS_PATH, and $JS_PATH), in my MY_Controller (but you could do it in your config file or whatever suits you best).

Then you can just do this:
Code:
<img src="&lt;?php echo $IMG_PATH.$image_thumb); ?&gt;" />

It has the advantages that if you every change your directory structure (ie, you move your images from "uploads" to a new folder called "public/images") all you have to do is change $IMG_PATH and everything else will still work! With your current set-up, if you ever change your directory structure you will have to go and change EVERY image src="..."


Messages In This Thread
Call Image Path From Database - by El Forum - 10-17-2012, 03:09 AM
Call Image Path From Database - by El Forum - 10-17-2012, 08:55 AM
Call Image Path From Database - by El Forum - 10-17-2012, 09:04 AM
Call Image Path From Database - by El Forum - 10-17-2012, 06:59 PM
Call Image Path From Database - by El Forum - 10-17-2012, 07:11 PM
Call Image Path From Database - by El Forum - 10-18-2012, 01:19 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.