Howdy all - new to ZP and LOVING it. So nice to have albums be organized as folders in the backend! No one else is doing thais (that i know of)! This makes life easier with the Digital Picture Frame that I built that downloads all the photos from my ZP page and displays them on the wall.
Which leads me to my question...
Since my photo frame has to have a specific file dimension (1920x1200) to be exact, I would like to limit any upload to be those EXACT dimensions (or allow the user to crop photos in a slick way). Is there a way to do this with a plugin that I don't know about? I've been digging around and haven't come up with anything yet. Any pointers in the right direction would be great, thanks! I'm relatively new to code. I understand some things about code but don't know a whole lot.
Comments
`
class UploadHandler {
private $options;
function __construct($options = null) {
$this->options = array(
'script_url' => $_SERVER['PHP_SELF'],
'upload_dir' => dirname(__FILE__) . '/files/',
'upload_url' => dirname($_SERVER['PHP_SELF']) . '/files/',
'param_name' => 'files',
// The php.ini settings upload_max_filesize and post_max_size
// take precedence over the following max_file_size setting:
'max_file_size' => null,
'min_file_size' => 1,
'accept_file_types' => '/.+$/i',
'max_number_of_files' => null,
'discard_aborted_uploads' => true,
'image_versions' => array(
// Uncomment the following version to restrict the size of
// uploaded images. You can also add additional versions with
// their own upload directories:
/*
'large' => array(
'upload_dir' => dirname(__FILE__).'/files/',
'upload_url' => dirname($_SERVER['PHP_SELF']).'/files/',
'max_width' => 1920,
'max_height' => 1200
),
'thumbnail' => array(
'upload_dir' => dirname(__FILE__).'/thumbnails/',
'upload_url' => dirname($_SERVER['PHP_SELF']).'/thumbnails/',
'max_width' => 80,
'max_height' => 80
)
*/
)
);
if ($options) {
$this->options = array_replace_recursive($this->options, $options);
}
}
`
But feel free to comment it out if it fits your purpose (you will need to do this again on any update). Or create a ticket so we might consider to add those as plugin options.
Note that the values are max width and height. So all enabling this will do is prevent larger images from being uploaded. Of course you could find where these items are referenced and change the code to check for exact matches.
But if I understand correctly, all you want is for the downloaded image size to be 1900x1200. It would be possible to make a plugin for the download that "cached" the image at 1900x1200 and provided the download from that cached image. For images that are already that size, no processing will occur. For ones that are not, then Zenphoto will resize them.
Certainly that would be a much more convenient solution.