2021-04-16, 13:51

Feb 27, 2012 — Notify Users module, ver. 0.5 released — user can choose between sending single message (...) »

2013-01-28, 08:32

19 студзеня 2013 у Гродне трагічна загінуў паэт, журналіст і мой сябар (...) »

2009-10-14, 07:19

The site Litaratura.org is devoted to Belarusian literary works and translations. (...) »

2009-01-12, 20:46

Late November 2008 marked the 20th anniversary of the official founding of the Belarusian (...) »

Registered User Area Log into This Site
Show Credits... Credits
~ / Public Domain Software / Photocrop Unveiled $_
Photocrop Unveiled
Click To View A Full Size Image...
2009-12-06, 12:41

Photocrop is a configurable frontend image uploader and resizing/ cropping/editing tool.

I wrote this application because people for whom we make sites often do not know how to deal with images. Cases when someone tries to post onto a website a five-megabyte photo are not exceptions. Photocrop is my attempt to solve this issue.

Try before you start

Photocrop’s demo site is located at photocrop.setpro.pl — please obey several simple rules written there in order to make life easier for me and other users ;)

Photocrop’s installation packages are attached at the bottom of this page, but, prior to anything else, please read this article entirely — it will take five minutes of your time while coding/ testing of Photocrop took many hours of mine...

Technical characteristics

Photocrop runs as a frontend application, but it is accessible for people who are in some way logged into the website. The MODx port of Photocrop assumes that manager users are eligible to access the application.

Photocrop manages images in the website’s single folder that it was configured for. This is the most common scenario — the website’s all images are kept in such a single folder. (Basing on a single Photocrop’s installation, however, you can run many Photocrop’s instances with different configurations and different interface languages.)

Photocrop does several things: uploads an image onto the website; resizes the image to reasonable dimensions; allows for further online cropping of the resized image, rotations, duplications, and renaming.

Resizing policy

An image is resized immediately after it is uploaded onto the server. In the first step, Photocrop calculates a new width and height of the uploaded image to satisfy the square value given by the IMAGE_MAX_SQUARE configuration parameter. Once the image’s sizes are recalculated in order to not exceed the maximum allowed square, Photocrop — as the second step — checks whether the image’s new width and height are within the limits given by IMAGE_MAX_WIDTH and IMAGE_MAX_HEIGHT or not. If the width and/ or height exceeds the allowed limit, Photocrop does another calculation. Once all limits are satisfied, the uploaded image is physically resampled and deposited in its destination folder.

Of course, you can do further adjustments by cropping your images in a handy and intuitive way...

Integration with the MODx site

Currently I worked out a MODx port of Photocrop — a version for use within any PHP-driven project is in my plans but their execution depends on many circumstances (first of all, on interest and support from the public).

You can integrate Photocrop with your MODx site by following several simple steps:

— download the package in a suitable archive format;

— unpack it to the root folder of your site preserving the archive’s internal directory structure or unpack the package locally and send the files over ftp;

— create two new snippets named Photocrop and PhotocropLink (you will find appropriate sources under assets/photocrop/snippets/);

— create a new page (based on the blank template) and call an uncached snippet on it:


— somewhere on your site call a snippet:

[[PhotocropLink? &idApp=`xyz`]]

where xyz stands for an id of the page created in the previous step — the snippet will display for a logged manager user a link to Photocrop’s page;

— Photocrop is preconfigured to manage images in an assets/images/ folder; enjoy your copy of Photocrop!

Upgrading to a newer version

Overwrite files, overwrite snippets.

Another instance, a different language

Of course, storing the site’s images in a single folder is the most common, but not an exhaustive scenario. If you have several folders and you would like to manage their content with Photocrop, then you need to call Photocrop with a different configuration. First of all, duplicate config.default.inc.php to, for example, config.custom.inc.php; next — adjust values in your new config file, and finally call another instance

[!Photocrop? &config=`custom`!]

The same applies to running Photocrop in a different language. Basing on the existing language file, create a new file, for example, lang.ru-RU_utf8.inc.php and use it in your Photocrop’s call:

[!Photocrop? &lang=`ru-RU_utf8`!]

Starting from 20091215 release you can also dynamically change Photocrop’s configuration parameters. In order to do this, first activate Photocrop’s URL extender (which is disabled by default) — on the page where you are hosting Photocrop call it as

[!Photocrop? &urlExt=`1`!]

Now you will be able to set Photocrop’s parameters on the fly, for instance:

[[PhotocropLink? &idApp=`xyz` &RESOURCE_URL=`assets/galleries/17/`]]

The resource URL set within PhotocropLink takes precedence over that fixed within a static config file. Some parameters, however, cannot be changed dynamically — they need to be set within a static config alone.

Important remarks on MaxiGallery + Photocrop scenario

Setting up Photocrop to work with MaxiGallery is easy. On the page where you are calling MaxiGallery, you also need to call

[[PhotocropLink? &idApp=`xyz` &RESOURCE_URL=`assets/galleries/[*id*]/`]]

Remember about activation of the URL extender in Photocrop itself (please see previous section).

Using the above scenario in a correct way, however, is neither easy nor obvious.

I know it, because periodically I have to repair the stuff on the (publicly accessible) gallery at photocrop.setpro.pl.

Once you have set up Photocrop to work within MaxiGallery’s folder, you need to keep in mind one thing: MaxiGallery, apart from managing images in its folder, also makes corresponding entries into the MODx database. You cannot use Photocrop for renaming or removing images that were previously uploaded by MaxiGallery and hope that everything is/ will be fine — these operations should exclusively be performed via MaxiGallery’s manager. Photocrop can only be used for visual adjustation of the images and/ or thumbnails (tn_*) in a gallery.

However, it is possible to upload via Photocrop new images and corresponding new thumbnails (remember about correct names for the latter: tn_*) onto the gallery, but in this case you will also need to execute „Resynch Gallery” command from within MaxiGallery’s manager. Upon „Resynch”, new images and their thumbnails become the MaxiGallery’s domain (as they were uploaded/ generated via MaxiGallery’s manager).

You can access Photocrop’s sources from my SVN repository either through browser or SVN client like TortoiseSVN (http and svn protocols are supported).

Download This Attachment... Photocrop 20100109 for MODx site — the very latest release as tar.bz2 package
Last modified: 2010-01-09, 00:00 — Size: 108,06 KB
Download This Attachment... Photocrop 20100109 for MODx site — the very latest release as tar.gz package
Last modified: 2010-01-09, 00:00 — Size: 110,64 KB
Download This Attachment... Photocrop 20100109 for MODx site — the very latest release as zip package
Last modified: 2010-01-09, 00:00 — Size: 118,79 KB
Follow the Link to an Internal Resource... Photocrop’s Live Demo
Link to an Internal Resource
Follow the Link to an Internal Resource... Photocrop’s Repository
Link to an Internal Resource
Follow the Link to an External Resource... Photocrop’s Thread on MODx Forum
Link to an External Resource