How to get image source path (<img src="")
Is there any way to get source path of an image on page created using image.php file?
An example from demo page on your site http://
www.zenphoto.org/demo/albums/album2/Cosmos06.jpg
If look at the source code of web link above, at the "image section", you will see this:
<div id="image">
<img src="/demo/cache/album2/Cosmos06_595.jpg" alt="Cosmos06" width="595" height="446" />
</div>
What I need is how to echo/print image source path. In example above this:
"/demo/cache/album2/Cosmos06_595.jpg"
It can be very useful. For example, for image licensing, in that case image source path is needed. Look in an example of image license html code below:
Creative Commons some license
Comments
http://www.zenphoto.org/demo/album2/Cosmos06.jpg.php
You probably are looking for `getFullImageURL`. However `"/demo/cache/album2/Cosmos06_595.jpg"` is the cached sized image, not the full one.
I suggest to review:
http://www.zenphoto.org/news/theming-tutorial
http://www.zenphoto.org/news/functions-documentation
Most every "print" function has also a "get" variant.
I tried with getFullImageURL but I do not get "pretty" path even if page is cached before. Page html source shows:
<img src="/cache/folder/image_w725_h408.jpg"
but for getFullImageURL I always get:
"/zp-core/full-image.php?a=folder&i=image.jpg&q=75"
How to get: <img src="/cache/folder/image_w725_h408.jpg"
There is not a means of "forcing" the image to be cached so that you can guarentee a link that is not the image processor.
In "printCustomSizedImageMaxSpace" I used custom values, example:
printCustomSizedImageMaxSpace(getBareImageTitle(),725,725); to best fit page design, so my images are 725 x 408 pixels.
With getDefaultSizedImage() I get path to image which height is 595, default size I guess (of course if I use printDefaultSizedImage() to make that image first).
So I tried with printCustomSizedImage() I hooped I will get right image path but I get error.
If you have any suggestions please let me know.
All parameters are documentated on the functions documentation. On the user guide there is also a tutorial how to read that functions guide.
Also again:
`getProtectedImageURL()` and `getFullImageURL();` and I get the same, this:
`/zp-core/full-image.php?a=folder&i=image.jpg&q=75`
Also I tried this:
`getDefaultSizedImage()` and I get this:
`/zp-core/i.php?a=folder&i=image.jpg&s=595&cw=&ch=&q=85`
and this:
`getUnprotectedImageURL()` and I get this:
/albums/folder/image.jpg
and this what you told me `getDefaultSizedImageURL` and I get this:
`Fatal error: Call to undefined function getUnprotectedFullImageURL() in ......image.php on line...`.
So, whatever I try I can not get this `/cache/folder/image_w725_h408.jpg`
What you actuallywant to get is the cached (sized) image url. As said several times you get that by using the "get" custom sized get functions (be it default, custom or custom maxspace). Since that cached image is not cached automatically but on request it always goes first through `i.php` to create that cached file. Please read
http://www.zenphoto.org/news/how-does-zenphoto-cache-
http://www.zenphoto.org/news/is-it-really-necessary-to-pre-cache-my-images-at-all-
So `/zp-core/i.php?a=folder&i=image.jpg&s=595&cw=&ch=&q=85` is actually the url to an uncached `/cache/folder/image_s595.jpg`
`getCustomSizedImageMaxSpace(725,725)`
And it works fine, of course I needed to pass parameters (725,725) in my case I use that size of image. Now I get right image path.
Thank you again.