best url to view images from another site (eg. wordpress)

Hi folks,

What is the best URL to view ZP images from another website (eg. wordpress) so that the height and width (etc.) can be set in url parameters? This is surely documented somewhere, but I can't find it.

I have been using zenphotopress to embed images into wordpress for 6 years no problems at all. Since 1.4.4 (or 1.4.X), the image URLs are broken and need to be updated.

Here's an example of what doesn't work anymore:
http://www.exploringbliss.com/photography/zp-core/i.php?a=canada&i=20090826-Canada-2701.jpg&w=590&h=

thanks for any suggestions you might have.

Cheers,
Fraser
«1

Comments

  • acrylian Administrator, Developer
    That actually never worked. Remove the "w" and "h" part and replace it by "s".
    http://www.zenphoto.org/documentation/core/_i.php.html
  • This is not going to work because of a security hole we closed. You will have to reference the cached version of the image or look to see what Zenphoto generates for the image processor reference--there is a security parameter added that is not easily guessable.
  • thanks guys.

    Below is what I ended up doing since we can't do this via url params anymore. Of course it would be easier if I just used the same size images in blog posts and in the gallery....

    1) temporarily change the size of ZP images in my theme's options to match the size i need wordpress (590)

    2) cache all images and change image size back to zenphoto size (795)

    3) change broken img src's in wordpress to newly cached images:
    - phpadmin: backup wordpress database table xx_posts, then search and export post_type "post" and export these rows to a file
    - in a text editor use find and replace to change the urls as needed in the exported sql file (for me it took 3 passes to get them completely)
    - delete the same rows just exported for the table xx_posts.
    - import the modified sql file (and test) into table xx_posts.

    4) Try to remember NOT to purge image cache!

    This works fine, but I will have to remember to do 1 & 2 everytime I want to display an images in wordpress that hasn't already been cached.
  • You do not have to change the theme image size to cache an arbitrary sized image. You can just set up such a size in the options for the cacheManager and select that when you cache the images.

    Sorry about the inconvenience--but the alternative is that someone could flood your site with image resizing requests in a severe denial of service attack by issuing arbitrary image processor links.
  • no worries, thanks for the cache manager tip. i reckon closing that security hole it a good thing, even though that means plugins like zenphotopress can't work anymore. oh well, it was a good run... :)
  • We have made a small modification of the security guard. Now if the image that the i.php link references has already been cached the image will be fetched. Otherwise the security guard kicks in. So all you have to do for the plugin to continue to work is to be sure you have cached the images.
  • sbillard, which version of zenphoto have the "small modification"?
  • acrylian Administrator, Developer
    That would be the support build or the soon coming 1.4.4.2 release.
  • Thanks! Waiting for to get new version soon.

    Besides, hope i.php can continue support &s=thumb parameter as well.

    For exmaple:

    http://www.hkceleb.com/pic/zp-core/i.php?a=kate-tsui-tsz-shan&i=kate-tsui-20110504-131612.jpg&s=thumb

    Many thanks in advance.

    Chris
  • acrylian Administrator, Developer
    I think it will support all parameters but only if the image has been cached already. (as mentioned above).
  • Dear acrylian,

    Does 1.4.4.3 version got the *new* feature? If yes, it seems does not work.

    Many thanks in advance.

    Chris
  • acrylian Administrator, Developer
    The images must have been cached already. I am not sure actually, if it is in the 1.4.4.x stream. Might be in 1.4.5 only.
  • acrylian,

    I just upgrade to 1.4.4.4, seems it does not "fix" the issue... Any hints when 1.4.5 will release... i am feature this feature for long long time...

    many thanks in advance.
  • 1.4.5 will release in June, but it mostly complete now. You can give it a try by downloading the branch from GitHub. There is a link on the Zenphoto.org webpage over on the right hand side.
  • acrylian Administrator, Developer
    There still are a few things for 1.4.5 on the list and I moved some of my tickets to 2.0 (meaning 1.4.6 actually) as I fear I won't manage it for 1.4.5.
  • Just so we are all on the same page, with the current builds of the 1.4.4 release there is an option for Image Processor Security. When this is set there is a token added to the i.php URI that must be valid when the image is processed. This will not change.

    If the option is set and an external site issues a fetch on an i.php image link that does not have this token and if the image is not already cashed the image will not be delivered.

    So your choices are:

    1. Cache the images you want to display externally
    2. Provide the proper uri with the token attached to the external site
    3. Turn off the option (but note that this is a security issue....)
  • Hi sbillard,

    > 1. Cache the images you want to display externally

    How to I generate cache image for i.php using s=thumb parameter?

    For example:

    http://www.hkceleb.com/pic/zp-core/i.php?a=kate-tsui-tsz-shan&i=kate-tsui-20110504-131612.jpg&s=thumb
  • acrylian Administrator, Developer
    If you call that url the image will be cached if it isn't already. If you need specific sizes in bulk you need to use the cache manager.
  • Please advise if following steps are correct

    1. On Option / Image page
    unchecked "Secure image processor" checkbox

    2. On Overview Page
    Click "Cache" button to generate all cache image

    On cache folder, I find the following cache image:

    kate-tsui-20110504-131612_128_thumb.jpg
    kate-tsui-20110504-131612_240_thumb.jpg
    kate-tsui-20110504-131612_40_cw40_ch40_thumb.jpg
    kate-tsui-20110504-131612_85_cw85_ch85_thumb.jpg
    kate-tsui-20110504-131612_85_thumb.jpg
    kate-tsui-20110504-131612_w128_h128_cw128_ch128_thumb.jpg
    kate-tsui-20110504-131612_w75_h75_cw75_ch75_thumb.jpg

    If I use the following link, the browser only return blank page:

    http://www.hkceleb.com/pic/zp-core/i.php?a=kate-tsui-tsz-shan&i=kate-tsui-20110504-131612.jpg&s=thumb

    Any hints?

    ** The above URL was generated by zenphotopress... and I have lot of Wordpress Post using it to display album thumbnail.
  • acrylian Administrator, Developer
    I think zenphotopress has currently an compatibility issue. You should link to the cached image directly `yourdomain.com/cache//`.

    The image processor i,php requires also an token to work. This has been added to prevent people to overload your server by sending random requests to the image processor.
  • According to sbillard reply, if I disable the security check, I can get the image if image already cached... Am I misunderstand his idea?
  • acrylian Administrator, Developer
    True, he did write that above. Then I have no idea and we should wait for his reply.
  • If you disable security checks you will get the image cached or not (and it will be cached once you have got it.) If the image is already cached you will get it even with the security check enabled.
  • sbillard,

    Just make sure my config is correct, please take a look on following printscreen.

    http://s13.postimg.org/uhxs3c68l/Photo_Gallery_admin_options_image.jpg

    If it is the correct, then there is something wrong with the coding, as it return blank page without error.
  • You have disabled the correct option. So I guess you need to look into your error logs to see what they are telling you. You can also enable `DEBUG_IMAGE` by setting the define to `true` in the `global-definitions.php` script to get a log of what is happening.
  • Here is the debug Log:

    {4774:Fri, 19 Apr 2013 15:18:31 GMT} Zenphoto v1.4.4.4[121605f7d74b874e059338dee7accca873881c6d]
    Loading GD

    {4774:Fri, 19 Apr 2013 15:18:32 GMT}
    i.php(kate-tsui-tsz-shan, kate-tsui-20110504-131612.jpg): $size=, $width=, $height=, $cw=, $ch=, $cx=, $cy=, $quality=85, $thumb=, $crop=, $thumbstandin=, $passedWM=, $adminrequest=, $effects=

    {4774:Fri, 19 Apr 2013 15:18:32 GMT}
    cacheImage($imgfile=kate-tsui-20110504-131612.jpg, $newfilename=/kate-tsui-tsz-shan/kate-tsui-20110504-131612.jpg, $allow_watermark=1, $theme=hkceleb4) $size=, $width=, $height=, $cw=, $ch=, $cx=NULL, $cy=NULL, $quality=85, $thumb=, $crop= $image_use_side=longest; $upscale=0);

    {4848:Fri, 19 Apr 2013 15:18:36 GMT}
    Loading GD

    Seems no error appear. Any hints?
  • You will probably have to check your server log. There should be more debug messages showing the progress of the image caching, so somewhere there probably has been a fatal PHP error that has aborted Zenphoto processing.
  • I checked the access log and find, it return 404 error..

    "GET /pic/zp-core/i.php?a=kate-tsui-tsz-shan&i=kate-tsui-20110504-131612.jpg&s=thumb HTTP/1.1" 404 - "-" "Mozilla/5.0 (Windows NT 6.1; rv:20.0) Gecko/20100101 Firefox/20.0"

    If I omit &s=thumb parameter, zenphoto can return image.

    Any hints?
  • acrylian Administrator, Developer
    `&s=thumb` is in any case wrong anyway. So where does that come from? `s` must be a number. For a thumb you need to use `t`. All parameters are documented on the i.php file beginning.
  • It generated by ZenPhotoPress plugin for Wordpress, it work properly when using older version of ZenPhoto (1.4.3.5).

    For example:

    http://www.hkgimages.com/pic/zp-core/i.php?a=sports/marathon/2013&i=hkgimages-20130224-083702-01.jpg&s=thumb

    will return following thumbnail:

    http://www.hkgimages.com/pic/cache/sports/marathon/2013/hkgimages-20130224-083702-01_75_cw75_ch75_thumb.jpg
Sign In or Register to comment.