Page 1 of 1

[SOLVED] Working with {url_prefix}

Posted: Fri Feb 04, 2005 1:23 pm
by pepper28
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

Posted: Fri Feb 04, 2005 1:34 pm
by voltrader
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:

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];
I haven't tested this, but I've done similar.

{url_prefix}

Posted: Fri Feb 04, 2005 1:49 pm
by pepper28
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