summaryrefslogtreecommitdiff
path: root/modules/system/system.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2005-02-01 16:27:43 +0000
committerDries Buytaert <dries@buytaert.net>2005-02-01 16:27:43 +0000
commit7ccc5a6b1b4541a11b858e09cbd8244909d89c92 (patch)
tree0742993a6678e544fb6bb2b28787414d38378b7d /modules/system/system.module
parent7931c778d75cec00bd0d186da18c08e5dcf9a5c4 (diff)
downloadbrdo-7ccc5a6b1b4541a11b858e09cbd8244909d89c92.tar.gz
brdo-7ccc5a6b1b4541a11b858e09cbd8244909d89c92.tar.bz2
- Patch #16358 by James: added toolkit to enable better image handling. The avatar code and the upload module have been updated to take advantage of the new image API.
There are 5 main functions that modules may now utilize to handle images: * image_get_info() - this function checks a file. If it exists and is a valid image file, it will return an array containing things like the pixel dimensions of the image, plus the 'type' and common extension. * image_scale - resizes a given image to fit within a given width / height dimensions, while maintaining aspect ratio (not distorting the image). This function can be used to generate thumbnails, or ensure a maximum resolution, etc. * image_resize - similar to image_scale (but will not respect aspect ratio - may well distort the image). * image_rotate - rotate an image by X degrees * image_crop - crops an image to a given rectangle (defined as top-left x/y coordinates plus a width & height of the rectangle). Contribution modules will now be able to rely on these base manipulation functions to offer additional functionality (such as image nodes, photo galleries, advanced image manipulation, etc).
Diffstat (limited to 'modules/system/system.module')
-rw-r--r--modules/system/system.module13
1 files changed, 12 insertions, 1 deletions
diff --git a/modules/system/system.module b/modules/system/system.module
index b0dcfb443..e42fd19d8 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -239,6 +239,17 @@ function system_view_general() {
$group .= form_radios(t('Download method'), 'file_downloads', variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC), array(FILE_DOWNLOADS_PUBLIC => t('Public - files are available using http directly.'), FILE_DOWNLOADS_PRIVATE => t('Private - files are transferred by Drupal.')), t('If you want any sort of access control on the downloading of files, this needs to be set to <em>private</em>. You can change this at any time, however all download URLs will change and there may be unexpected problems so it is not recommended.'));
$output .= form_group(t('File system settings'), $group);
+ // image handling:
+ $group = '';
+ $toolkits_available = image_get_available_toolkits();
+ if (count($toolkits_available) > 1) {
+ $group .= form_radios(t('Select an image processing toolkit'), 'image_toolkit', variable_get('image_toolkit', image_get_toolkit()), $toolkits_available);
+ }
+ $group .= image_toolkit_invoke('settings');
+ if ($group) {
+ $output .= form_group(t('Image handling'), $group);
+ }
+
// date settings:
$zones = _system_zonelist();
@@ -612,7 +623,7 @@ function system_theme_settings() {
// Check for a new uploaded logo, and use that instead.
if ($file = file_check_upload('logo_upload')) {
- if (in_array($file->filemime, array('image/jpeg', 'image/gif', 'image/png'))) {
+ if ($info = image_get_info($file->filepath)) {
$parts = pathinfo($file->filename);
$filename = ($key) ? str_replace('/', '_', $key) . '_logo.' . $parts['extension'] : 'logo.' . $parts['extension'];