Plugin Name: Copperleaf Photolog for Wordpress Plugin URI: http://www.copperleaf.org/copperleaf-photo-log-plugin/ Version: 0.16 Author: Bill Smith Author URI: http://www.copperleaf.org Description ----------- Copperleaf Photolog for Wordpress(CPL for short, not to be confused with Customizable Post Listings) is a photo management tool for Wordpress. It allows for easily adding thumbnails and inline images to posts and pages. Requirements/Restrictions ------------------------- - Works with Wordpress 2.x. - Requires Javascript to be enabled and to be a recent browser for the admin pages. - The only format currently supported in JPEG. - Requires either GD2 to be compiled into php or imagemagick (convert) to be installed as a command line utility. - For EXIF support, requires that EXIF be compiled into php. Installation ------------ Download the zip file at http://www.copperleaf.org/copperleaf-photo-log-plugin/ and expand (keeping the directories) into your wp-content/plugins directory and activate it. The database tables wp_cpl and wp_cpl_post will be created. Configuration ------------- After the plugin is activated, you can configure it by selecting the CPL tab on the Options page. Here is a list of the options: Default Description - When a photo is added, this is the default description that will be associated with the photo. Default Photographer - When a photo is added, this is the default photographer that will be associated with the photo. Default Server Directory - Photos can be ftp'd to a server directory then added which is useful for large additions. This is the directory on the server where the photos will be retrieved. Make sure it is an absolute path and that you have permissions for the server to delete the files when done. Storage Directory - This is the relative directory under wp-content where the images will be stored. JPEG Quality Level - For generated images, thumbnails, etc. this is the JPEG quality to use. Max Cache Size - Used to improve query performance. The max number of images "per page" to cache. If the number of images on a page exceeds this value, no caching is done. Default is 250. Set to 0 to disable. Auto Purge - When a photo is no longer associated with a post or page (because the page or post has been deleted), this will delete the abandoned images. Minimum Admin Level - This is the mimimum user level required to get to the admin page. (I haven't switched to the user level strings used by Wordpress 2.x yet.) Convert Path - This is a path to the convert utility which does a better job than gd for resizing images. Leave blank to use gd. Exif Strip Size - If both sides of an image are smaller than this number, the exif info will be stripped. This only applies when convert is being used as gd already strips the exif info. This can save alot of download space when using alot of thumbnails. Max Original Size - If an uploaded original has both sides larger than this value, it will be resized to fit. "Photo of the Day" Category - If you want to have a photo of the day in you sidebar, set a category name here. If a post is in that category, it will be hidden from the main page, but can still be displayed in the sidebar. Leave it blank to disable it. See the CopperleafPlus theme for an example of how to do this with your sidebar. Hide "Photo of the Day" Posts - By default, posts that are in the photo of the day category above are filtered from the main page. If you would like to display them on the main page too, disable this field. Usage ----- Once activated, a section is added to the post and page edit views. For posts, this is in the advanced section. This will appear just below the editor. From this view, you can add photos and insert them into the post or page. NOTE: The current implementation requires that a post/page have an id, thus, a page must be saved one time before photos can be added. There is a messsage that will indicate this. To add photos, click the "Add Photo(s)" button. A dialog will appear that will let you either 1) upload a photo via the browser, 2) add photos that have already been ftp'd to the server, 3) Add photos that are already part of another post. Once some photos have been added, they will appear in a table in the center of the view. On the left of the table are buttons that will let you edit the data, delete them, or change their order. To insert photos into the post or page, you can click the "insert matrix" button which will insert the tage '' into the editor. When displayed, this tag will expand to show a matrix of thumbnails in the post. Additionally, there is a button to the left of each image that will let you insert just that image into the post. When you click it, it will insert a '' into the editor (where 4 is the id assigned by cpl for that image). There is an option that you can manually add that will limit the number of thumbnails that will appear on the index page. Modify the tag to look something like ''. This example will only display 8 thumbnails on the index page. There is another option that will let you group photos when displaying a matrix. If you specify something like '', then only photos that match group number 1 in the post will be displayed. By default, photos are added to group 0 which is the default group. If you want to change the order of images in the post (for the cplmatrix tag), you can move them up and down with the arrows to the left of each image, or you can click the "rearrange photos" button. Clicking this button will bring up a dialog where you can click an image, then click where you want it to go, and it will be moved there. (This is much more efficient than the arrows approach). For developing different layouts, take a look at the files cpltemplate.js, cpltemplate.php, cpltemplate.css and cplphoto.php in the cpl directory. These pages are used to generate the layout of cplmatrix and cplinline. Basically there are three functions: getCplHead, getCplMatrix and getCplInline. They each return a string of html that is inserted into the header, matrix and inline tagss. They use the CplApi class defined in cplview.php. Another example is in the CopperleafPlus theme which has it's own slightly modified versions of these files and also supports a "photo of the day" in the sidebar. One specific API note that pertains to displaying the "photo of the day". If you want to use the photo of the day functionality, add CplApi::photoOfTheDay(); to your themes sidebar.php. Without any arguments, it will display the first image of newest post in the photo of the day category. There are two arguments that can be passed. The first is the mode: newest | random | roundrobin | newestrandom | newestroundrobin. The newest is the same as no arguments as stated above. Random mode will grab a photo from any post in the photo of the day category. Roundrobin will iterate through all posts in the photo of the day category. For random and roundrobin modes, this will only change once per day. The modes newestrandom and newestroundrobin will behave like the newest mode if a new "photo of the day" image has been posted in the last 24 hours, otherwise it behaves like random or roundrobin modes. The second argument is a boolean (true | false) that will display the title of the post containing the photo. True means that the title will be displayed. Notes ----- - With the progress dialog when adding photos from a server directory, some server configurations may prevent the progress from showing. One situation is if mod_gzip is installed on the server (Apache). If this is the case, the following section should be added to your http.conf or .htaccess: mod_gzip_item_exclude file cpladmloadstat\.php$ Another is a bug that was introduced in php 4.1 that prevented ob_flush() from truely flushing until an 8k buffer has been filled. This has been fixed in php but there may still be installs with the bug. - Execution timelimits can also cause problems with large uploads consider adding/modifying the following lines to to your php.ini: max_execution_time = 300 ; Maximum execution time of each script, in seconds max_input_time = 300 ; Maximum amount of time each script may spend parsing request data memory_limit = 16M ; Maximum amount of memory a script may consume (16MB) Additionally, you may want to look at the timeout for the webserver. For Apache, look at the following in your http.conf: # # Timeout: The number of seconds before receives and sends time out. # Timeout 300 rel 0.16 (11 Apr 2008) -------- - Fixed fatal error when used with Wordpress 2.5. rel 0.15 (5 Oct 2007) -------- - Fixed bug with photo of the day functionality that prevented it from changing. rel 0.14 (26 Sept 2007) -------- - Added getRandomPhotos static method. - Added "Edit All Photos" functionality. - Now prefills in photographer with exif field "artist" if found. - Updated taxonomy functionality to support WP2.3. rel 0.13 (26 Apr 2007) -------- - Added query caching for images. - Added "comment" at bottom of page showing cache hits and misses. rel 0.12 (18 Dec 2006) -------- - Added diagnostics tool to options page. rel 0.11 (3 Nov 2006) -------- - Added support for changes in WP 2.1. - Added photo group functionality. - Fixed TinyMCE bug when inserting matrix. rel 0.10 (10 Feb 2006) -------- - Reworked the "photo of the day" code and added two more modes: newestrandom and newestroundrobin rel 0.9 (2 Feb 2006) ------- - Added index to photo query to improve query speed. rel 0.8 (1 Feb 2006) ------- - Fixed a bug that prevented the default photo template from displaying. - Added two addition "photo of the day" modes: random & roundrobin. - Added photo of the day option to not hide posts on the main page. - Added photo of the day option to not display title text in the sidebar. rel 0.7 (19 Jan 2006) ------- - Added support for platforms that do not have exif enabled in php. - Added GPL license.txt file. rel 0.6 (17 Jan 2006) ------- - Added support for the TinyMCE editor in Wordpress 2.x. - Fixed error when starting a post that doesn't have an id yet. - Fixed a bug that shows a blank add at the top of the Add Photos dialog. - Added image id to the view on the write screen. - Added support for resizing the original when being uploaded. - Added support for stripping exif info from small images. - Centered the dialogs on admin screens. - Fix error when saving the new order in the rearrange dialog. - Added support for inserting images into pages. - Added a progress dialog when loading images from server dir. - Fixed some CSS problems with the rearrange dialog.