]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #4011 icon sizes are configurable now
authorcash <cash.costello@gmail.com>
Fri, 28 Oct 2011 01:47:12 +0000 (21:47 -0400)
committercash <cash.costello@gmail.com>
Fri, 28 Oct 2011 01:47:12 +0000 (21:47 -0400)
actions/avatar/crop.php
engine/lib/views.php
mod/groups/actions/groups/edit.php

index 9c57530aee8c26acbcaa586d3017b02d3f75bb77..39061fa2cd5d701aa6a88600d3546a84c23fffd0 100644 (file)
@@ -22,14 +22,7 @@ $filehandler->owner_guid = $owner->getGUID();
 $filehandler->setFilename("profile/" . $owner->guid . "master" . ".jpg");
 $filename = $filehandler->getFilenameOnFilestore();
 
-//@todo make this configurable?
-$icon_sizes = array(
-       'topbar' => array('w'=>16, 'h'=>16, 'square'=>TRUE, 'upscale'=>TRUE),
-       'tiny' => array('w'=>25, 'h'=>25, 'square'=>TRUE, 'upscale'=>TRUE),
-       'small' => array('w'=>40, 'h'=>40, 'square'=>TRUE, 'upscale'=>TRUE),
-       'medium' => array('w'=>100, 'h'=>100, 'square'=>TRUE, 'upscale'=>TRUE),
-       'large' => array('w'=>200, 'h'=>200, 'square'=>FALSE, 'upscale'=>FALSE)
-);
+$icon_sizes = elgg_get_config('icon_sizes');
 
 // get the images and save their file handlers into an array
 // so we can do clean up if one fails.
index 070b59e37cf6ac07aa9f89da760834dd9cce81fa..e8cb20232568ec9252abae2703f4c20fe1862f1d 100644 (file)
@@ -1617,6 +1617,19 @@ function elgg_views_boot() {
                        elgg_register_viewtype($view);
                }
        }
+
+       // set default icon sizes - can be overridden in settings.php or with plugin
+       if (!elgg_get_config('icon_sizes')) {
+               $icon_sizes = array(
+                       'topbar' => array('w'=>16, 'h'=>16, 'square'=>TRUE, 'upscale'=>TRUE),
+                       'tiny' => array('w'=>25, 'h'=>25, 'square'=>TRUE, 'upscale'=>TRUE),
+                       'small' => array('w'=>40, 'h'=>40, 'square'=>TRUE, 'upscale'=>TRUE),
+                       'medium' => array('w'=>100, 'h'=>100, 'square'=>TRUE, 'upscale'=>TRUE),
+                       'large' => array('w'=>200, 'h'=>200, 'square'=>FALSE, 'upscale'=>FALSE),
+                       'master' => array('w'=>550, 'h'=>550, 'square'=>FALSE, 'upscale'=>FALSE),
+               );
+               elgg_set_config('icon_sizes', $icon_sizes);
+       }
 }
 
 elgg_register_event_handler('boot', 'system', 'elgg_views_boot', 1000);
index 3a03764970dc13ef9603c64892f527fc865d6480..27f6e04265a226c800a06756df0ea01b66559e5b 100644 (file)
@@ -111,7 +111,10 @@ if (elgg_get_plugin_setting('hidden_groups', 'groups') == 'yes') {
 
 // Now see if we have a file icon
 if ((isset($_FILES['icon'])) && (substr_count($_FILES['icon']['type'],'image/'))) {
-       $prefix = "groups/".$group->guid;
+
+       $icon_sizes = elgg_get_config('icon_sizes');
+
+       $prefix = "groups/" . $group->guid;
 
        $filehandler = new ElggFile();
        $filehandler->owner_guid = $group->owner_guid;
@@ -120,10 +123,10 @@ if ((isset($_FILES['icon'])) && (substr_count($_FILES['icon']['type'],'image/'))
        $filehandler->write(get_uploaded_file('icon'));
        $filehandler->close();
 
-       $thumbtiny = get_resized_image_from_existing_file($filehandler->getFilenameOnFilestore(),25,25, true);
-       $thumbsmall = get_resized_image_from_existing_file($filehandler->getFilenameOnFilestore(),40,40, true);
-       $thumbmedium = get_resized_image_from_existing_file($filehandler->getFilenameOnFilestore(),100,100, true);
-       $thumblarge = get_resized_image_from_existing_file($filehandler->getFilenameOnFilestore(),200,200, false);
+       $thumbtiny = get_resized_image_from_existing_file($filehandler->getFilenameOnFilestore(), $icon_sizes['tiny']['w'], $icon_sizes['tiny']['h'], $icon_sizes['tiny']['square']);
+       $thumbsmall = get_resized_image_from_existing_file($filehandler->getFilenameOnFilestore(), $icon_sizes['small']['w'], $icon_sizes['small']['h'], $icon_sizes['small']['square']);
+       $thumbmedium = get_resized_image_from_existing_file($filehandler->getFilenameOnFilestore(), $icon_sizes['medium']['w'], $icon_sizes['medium']['h'], $icon_sizes['medium']['square']);
+       $thumblarge = get_resized_image_from_existing_file($filehandler->getFilenameOnFilestore(), $icon_sizes['large']['w'], $icon_sizes['large']['h'], $icon_sizes['large']['square']);
        if ($thumbtiny) {
 
                $thumb = new ElggFile();