Jump to content

Recommended Posts

I'll explain how I'm trying to use it.

 

I'm building an html page dynamically, previewing the content in the current page and then writing it as page.html

page.html is written to a different directly, so now I have the problem that images dynamically added have the wrong path.

To fix this I would need to use an absolute/full URL for the image location, but don't want to hardcode it.

just thought there must be a way to get the full path of a current location?

 

thanks

Hi all,

A newbie question.

How do I define the full URL in my html image? So instead of

<img src="images/top_invoice.gif" width="560" height="33"/>

 

I'd like, something like <img src=.relative url./images/top_invoice.gif" width="560" height="33"/>

 

thanks

 

If your domain is test.com

If you want relative url, relative path or root path.

'<img src=' . $_SERVER['DOCUMENT_ROOT'] . '/images/top_invoice.gif' etc.....

would yeild www.test.com/images/top_invoice.gif

 

Would allow you to have just one images folder instead of an images folder in every folder which you will need if using:

"<img src=\"" . $_SERVER['PHP_SELF'] . "/images/top_invoice.gif\">";

would yeild www.test.com/current_folder/images/top_invoice.gif

 

 

 

Hi all,

A newbie question.

How do I define the full URL in my html image? So instead of

<img src="images/top_invoice.gif" width="560" height="33"/>

 

I'd like, something like <img src=.relative url./images/top_invoice.gif" width="560" height="33"/>

 

thanks

 

If your domain is test.com

If you want relative url, relative path or root path.

'<img src=' . $_SERVER['DOCUMENT_ROOT'] . '/images/top_invoice.gif' etc.....

would yeild www.test.com/images/top_invoice.gif

 

Would allow you to have just one images folder instead of an images folder in every folder which you will need if using:

"<img src=\"" . $_SERVER['PHP_SELF'] . "/images/top_invoice.gif\">";

would yeild www.test.com/current_folder/images/top_invoice.gif

 

 

 

 

To fix this I would need to use an absolute/full URL for the image location' date=' [b']but don't want to hardcode it.[/b]

just thought there must be a way to get the full path of a current location?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.