Help with adding image embeds?

Hi,

I'd like to add sharing options/image embeds (basically an easy way for users to hotlink the image on message boards and whatnot). You can see an example on sites like ImageShack, TwitPic, and many others.

The problem is that the URL structure ZenPhoto generates: zp-core/full-image.php?a=misc%2Fheadshots&i=2007-headshot-kevin-weaver.jpg&q=100&wmk=aa causes some forum software to not recognize it as an image and treats it as a text link instead. I guess it's the question mark and ampersands, or perhaps the fact that the URL doesn't end in the .jpg extension.

Additionally this is the full image (3490 x 3600 pixels) which is several megabytes large and obviously not ideal for embedding/hotlinking.

So what I'm attempting to do is retrieve the URL of the cached/"sized" image (640px in my case) with watermark on it. I've looked over the function guide and don't see any way to do this. I'm wondering if anyone has tackled this or can point me in the right direction. Thanks!

Comments

  • acrylian Administrator, Developer
    The problem is that cached images are always served via the i.php script. The reason is that Zenphoto creates these images on request and not preliminary. So if it does not exist it needs to be created (see the troubleshooting for info about that, there is also a diagram).

    If I am not mistaken there is a 3rd party bbcode plugin to do these things. A lot of forum software does work with that (except ours).
  • acrylian Administrator, Developer
    Btw, you probably need to escape the `&` to `&`. There are standard PHP functions to do that and also our `html_encode()`.
  • If the image has been cached the normal image url functions will return the link to the cached version of the image. The problem really is to insure that the image is cached before you provide it to someone for use.

    As to the size of the image, if you use one of the custom image functions you can get a URL to an image of any specific size you wish. Again, only after the image has been loaded at least once will it be cached.

    Note that the caching happens when the i.php script is executed, so [typically] not until a browser client fetches the image.
Sign In or Register to comment.