Member
Member
amereservant   2011-06-18, 17:16
#1

I'm not finding any function that generates this, but I'm needing to create a full image link URL as in [b]http://mywebsite.domain/zenphoto/sample/img_4448.jpg.php[/b] and not just [b]/zenphoto/sample/img_4448.jpg.php[/b].

My first thought was to use echo getMainSiteURL() . $_zp_current_image->getImageLink();, but there's multiple issues with this:

[list]
[]If the user fills in [b]Website URL[/b] with a trailing slash, then there will be two trailing slashes between the URL and image link. This is easily fixed using the trim() function in PHP.
[
]The main issue is with the URL example I used above, where the gallery is installed in a sub-directory. If I fill in [b]Website URL[/b] with [i]http://mywebsite.domain/zenphoto/[/i], when I call those two functions, it will output [b]http://mywebsite.domain/zenphoto//zenphoto/sample/img_4448.jpg.php[/b], which means I'd need to write a function that tests for the sub-directory, etc.
[/list]
So I'm hoping there's an easier way to do this ....

Member
Member
kagutsuchi   2011-06-19, 00:32
#2

I think what you're looking for is the FULLWEBPATH define (see functions-basic.php for the definition itself).

Administrator
Administrator
acrylian   2011-06-19, 08:13
#3

Btw, your url examples show the image page link, not the full image link. That is a difference!

We have a function for the full image link named getFullImageURL() (there is also a protected version). There is of course also a image class method getFullImage() for this.

Besides that kagutsuchi is right, but all of these functions should use that interally (if I recall right).

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.