Fork me on GitHub

Image cropping for Pagesetter?  Bottom

  • Hey all...

    I have a situation where I'd like to allow users to upload an image in a Pagesetter publication through pgForm to be used as a thumbnail... piece of cake right... Thing is, I'd like that image to remain a square with fixed dimensions and suffice it to say that many of my users won't remember to edit the image on their computers before uploading...

    There are plenty of scripts that allow the cropping of an image to create a thumbnail... the question is how best to incorporate this into a pagesetter/pgForm plugin?

    http://www.hotscripts.com/blog/javascript-image-cropping-scripts/

    As always, thanks in advance!

    -Julian

    --
    Burnham Racing
    Illinois Cycling Association
  • I've mentioned this before...

    There is a module called Thumbnail. I had a situation exactly like yours and my idea was to create a pnRender plugin where I would pass parameters - image URL, width, height, etc. - and the plugin would send the URL to Thumbnail and return a resized image. I had it working based on a test image at a static URL on the file system. However it wouldn't work with URLs consisting of a query string like Pagesetter uses. The Thumbnail module is based on phpThumb, and that does work with query strings, so there must be something in the Zikula module portion of it that is defeating it.

    I didn't have time to debug it. Maybe you do? icon_wink
  • Thanks for the reply bronto-

    I have Thumbnail installed but a.) it is a mess b.) there's no documentation so I have no idea how to use it and c.) like you said it doesn't work with Pagesetter URL's.

    There is a convoluted way of getting the actual file path for a Pagesetter image using Smarty from within the publication...

    Code

    <!--[assign var=picture value=http://www.YOUR SITE.com/uploads/`$tid`x`$pid`x`$revision`xphoto.dat]-->


    That will get the most recent revision of the image based on Jorn's naming convention: 1x2x1xphoto.dat

    tid 1, pid 2, revision 1...

    You can get the thumb too:

    Code

    <!--[assign var=picture value=http://www.YOUR SITE.com/uploads/`$tid`x`$pid`x`$revision`xphoto-tmb.dat]-->


    I suppose that then you could simply crop the image to the size you wish using a plugin and/or Smarty... Not the best way of doing it as it strips the user of the ability to resize/crop their photo themselves but so it goes right...

    --
    Burnham Racing
    Illinois Cycling Association
  • Right. I actually tossed what I did and went directly to phpThumb since it does work with Pagesetter URLs, but it's pretty ugly and I'm embarrassed to show it. Does work though...

    My own requirements had nothing to do with users being able to determine their own sizes, FWIW.

This list is based on users active over the last 60 minutes.