I currently have a database with a table that contains images with are stored as follows:
{url_prefix}/image.php?filename=ps_468x60_1.gif&contenttype=gif
I would like to access this field and replace the {url_prefix} with my domain address http://www.mydomain.com. I only want this change to happen upon a Select request and not through a conversion of the table to include my domain information. The resulting path should look as follows:
http://www.mydomain.com/image.phpfilena ... nttype=gif
Thanks in advance for your help,
Pepper28
[SOLVED] Working with {url_prefix}
Moderator: General Moderators
Instead of going through the db and renaming all the strings, you could use PHP to rename the photo on every access of the field. Something like:
I haven't tested this, but I've done similar.
Code: Select all
// $string = url string
$new_string=explode("/", $string);
// rebuild the string with your new domain
$new_domain_url="http://www.mydomain.com/".$new_stringї3];{url_prefix}
Thanks Voltrader,
Your recommendation works great! I was racking my brain for a few days trying to figure out how to do what you suggested.
Thanks agaian very much!
Pepper28
Your recommendation works great! I was racking my brain for a few days trying to figure out how to do what you suggested.
Thanks agaian very much!
Pepper28