source: trunk/plugins/ImageManager/config.inc.php

Last change on this file was 1321, checked in by gogo, 5 years ago

Merge the MootoolsFileManager?-Update branch into the trunk.

  • Property svn:keywords set to LastChangedDate LastChangedRevision LastChangedBy HeadURL Id
File size: 13.3 KB
Line 
1<?php
2/**
3 * Image Manager configuration file.
4 * @author $Author:gogo $
5 * @version $Id:config.inc.php 830 2007-05-09 13:27:34Z gogo $
6 * @package ImageManager
7 *
8 * @todo change all these config values to defines()
9 */
10
11// REVISION HISTORY:
12//
13// 2005-03-20 Yermo Lamers (www.formvista.com):
14//      . unified backend.
15// . created a set of defaults that make sense for bundling with Xinha.
16
17// -------------------------------------------------------------------------
18
19/**
20* Default backend URL
21*
22* URL to use for unified backend.
23*
24* The ?__plugin=ImageManager& is required.
25*/
26
27$IMConfig['backend_url'] = "backend.php?__plugin=ImageManager&";
28
29/**
30* Backend Installation Directory
31*
32* location of backend install; these are used to link to css and js
33* assets because we may have the front end installed in a different
34* directory than the backend. (i.e. nothing assumes that the frontend
35* and the backend are in the same directory)
36*/
37
38$IMConfig['base_dir'] = getcwd();
39$IMConfig['base_url'] = '';
40
41// ------------------------------------------------------------
42
43/**
44* Path to directory containing images.
45*
46* File system path to the directory you want to manage the images
47* for multiple user systems, set it dynamically.
48*
49* NOTE: This directory requires write access by PHP. That is,
50* PHP must be able to create files in this directory.
51* Able to create directories is nice, but not necessary.
52*
53* CHANGE THIS: for out-of-the-box demo purposes we're setting this to ./demo_images
54* which has some graphics in it.
55*/
56
57// $IMConfig['images_dir'] = "/some/path/to/images/directory;
58
59$IMConfig['images_dir'] = "demo_images";
60
61// -------------------------------------------------------------------------
62
63/**
64* URL of directory containing images.
65*
66* The URL to the above path, the web browser needs to be able to see it.
67* It can be protected via .htaccess on apache or directory permissions on IIS,
68* check you web server documentation for futher information on directory protection
69* If this directory needs to be publicly accessiable, remove scripting capabilities
70* for this directory (i.e. disable PHP, Perl, CGI). We only want to store assets
71* in this directory and its subdirectories.
72*
73* CHANGE THIS: You need to change this to match the url where you have Xinha
74* installed. If the images show up blank chances are this is not set correctly.
75*/
76
77// $IMConfig['images_url'] = "/url/to/above";
78
79// try to figure out the URL of the sample images directory. For your installation
80// you will probably want to keep images in another directory.
81
82$IMConfig['images_url'] = str_replace( "backend.php", "", $_SERVER["PHP_SELF"] ) . "demo_images";
83
84// -------------------------------------------------------------------------
85
86/**
87* PHP Safe Mode?
88*
89* Possible values: true, false
90*
91* TRUE - If PHP on the web server is in safe mode, set this to true.
92* SAFE MODE restrictions: directory creation will not be possible,
93* only the GD library can be used, other libraries require
94* Safe Mode to be off.
95*
96* FALSE - Set to false if PHP on the web server is not in safe mode.
97*/
98
99$IMConfig['safe_mode'] = false;
100
101// -------------------------------------------------------------------------
102
103/**
104* Image Library to use.
105*
106* Possible values: 'GD', 'IM', or 'NetPBM'
107*
108* The image manipulation library to use, either GD or ImageMagick or NetPBM.
109* If you have safe mode ON, or don't have the binaries to other packages,
110* your choice is 'GD' only. Other packages require Safe Mode to be off.
111*
112* DEFAULT: GD is probably the most likely to be available.
113*/
114
115$IMConfig['IMAGE_CLASS'] = 'GD';
116
117
118// -------------------------------------------------------------------------
119
120/**
121* NetPBM or IM binary path.
122*
123* After defining which library to use, if it is NetPBM or IM, you need to
124* specify where the binary for the selected library are. And of course
125* your server and PHP must be able to execute them (i.e. safe mode is OFF).
126* GD does not require the following definition.
127*/
128
129$IMConfig['IMAGE_TRANSFORM_LIB_PATH'] ='/usr/bin/';
130
131// For windows, something like
132// C:/"Program Files"/ImageMagick-5.5.7-Q16/
133
134// -------------------------------------------------------------------------
135//                OPTIONAL SETTINGS
136// -------------------------------------------------------------------------
137
138/**
139* Thumbnail prefix
140*
141* The prefix for thumbnail files, something like .thumb will do. The
142* thumbnails files will be named as "prefix_imagefile.ext", that is,
143*  prefix + orginal filename.
144*/
145
146$IMConfig['thumbnail_prefix'] = '.';
147
148// -------------------------------------------------------------------------
149
150/**
151* Thumbnail Directory
152*
153* Thumbnail can also be stored in a directory, this directory
154* will be created by PHP. If PHP is in safe mode, this parameter
155*  is ignored, you can not create directories.
156*
157*  If you do not want to store thumbnails in a directory, set this
158*  to false or empty string '';
159*/
160
161$IMConfig['thumbnail_dir'] = '.thumbs';
162
163// -------------------------------------------------------------------------
164
165/**
166 * Resize files, or not.  If the dimensions for an image are changed
167 * this will control if the image is actually resized. 
168 *
169 * Usually you want this true, unless you are very disk space concious.
170 */
171 
172$IMConfig['resize_files'] = true;
173
174// -------------------------------------------------------------------------
175
176/**
177* Resized prefix
178*
179* The prefix for resized files, something like .resized will do.  The
180* resized files will be named <prefix>_<width>x<height>_<original>
181* resized files are created when one changes the dimensions of an image
182* in the image manager selection dialog - the image is scaled when the
183* user clicks the ok button.
184*/
185
186$IMConfig['resized_prefix'] = '.resized';
187
188// -------------------------------------------------------------------------
189
190/**
191* Resized Directory
192*
193* Resized images may also be stored in a directory, except in safe mode.
194*/
195
196$IMConfig['resized_dir'] = '.resized';
197
198/**
199 * Full options
200 *
201 * Determines whether the user is given options for padding,
202 * background/padding colour, margin, border and border colour.
203 */
204
205$IMConfig['show_full_options'] = true;
206 
207// -------------------------------------------------------------------------
208
209/**
210* Allow New Directories
211*
212*
213* Possible values: true, false
214*
215* TRUE -  Allow the user to create new sub-directories in the
216*        $IMConfig['base_dir'].
217*
218* FALSE - No directory creation.
219*
220* NOTE: If $IMConfig['safe_mode'] = true, this parameter
221*     is ignored, you can not create directories
222*
223* DEFAULT: for demo purposes we turn this off.
224*/
225
226$IMConfig['allow_new_dir'] = false;
227
228// -------------------------------------------------------------------------
229
230/**
231* Allow Uploads
232*
233*  Possible values: true, false
234*
235*  TRUE - Allow the user to upload files.
236*
237*  FALSE - No uploading allowed.
238*
239* DEFAULT: for demo purposes we turn this off.
240*/
241
242$IMConfig['allow_upload'] = false;
243
244// -------------------------------------------------------------------------
245
246/**
247* Allow Delete
248*
249*  Possible values: true, false
250*
251*  TRUE - Allow the user to delete files/dirs
252*
253*  FALSE - No deleting allowed.
254*
255*/
256
257$IMConfig['allow_delete'] = false;
258
259// -------------------------------------------------------------------------
260
261/**
262* Allow Edit
263*
264*  Possible values: true, false
265*
266*  TRUE - Allow the user to edit files
267*
268*  FALSE - No editing allowed.
269*
270*/
271
272$IMConfig['allow_edit'] = false;
273
274
275// -------------------------------------------------------------------------
276
277/**
278* Validate Images
279*
280* Possible values: true, false
281*
282* TRUE - If set to true, uploaded files will be validated based on the
283*        function getImageSize, if we can get the image dimensions then
284*        I guess this should be a valid image. Otherwise the file will be rejected.
285*
286* FALSE - All uploaded files will be processed.
287*
288* NOTE: If uploading is not allowed, this parameter is ignored.
289*/
290
291$IMConfig['validate_images'] = true;
292
293$IMConfig['allowed_image_extensions'] = array("jpg","gif","png","jpeg");
294
295// -------------------------------------------------------------------------
296
297/**
298* Default Thumnail.
299*
300* The default thumbnail if the thumbnails can not be created, either
301* due to error or bad image file.
302*/
303
304$IMConfig['default_thumbnail'] = 'img/default.gif';
305
306// -------------------------------------------------------------------------
307
308/**
309*  Thumbnail dimensions.
310*/
311
312$IMConfig['thumbnail_width'] = 96;
313$IMConfig['thumbnail_height'] = 96;
314
315// -------------------------------------------------------------------------
316
317/**
318* Editor Temporary File Prefix.
319*
320* Image Editor temporary filename prefix.
321*/
322
323$IMConfig['tmp_prefix'] = '.editor_';
324
325
326$IMConfig['ViewMode'] = 'thumbs';
327
328// -------------------------------------------------------------------------
329
330/** Margin Types
331 *  If your HTML will be used in an email, then using CSS type "margin"
332 *  is not so reliable and you should set UseHSpaceVSpace to be true
333 *  to go back to the old fashioned hspace="" and vspace="" attributes on
334 *  images.
335 */
336$IMConfig['UseHSpaceVSpace'] = false;
337
338// -------------------------------------------------------------------------
339
340/**
341 * ImageManager/Picker can provide selection interfaces for more than just
342 * images on the server ("Pictures").
343 *
344 *  Local - the classical ImageManager for images stored on this server.
345 *
346 *  YouTube  - provides selection (but not upload etc) of videos on YouTube
347 *    see smart-image.js for how to make the videos work as videos instead of
348 *    static images.
349 *
350 *  Flickr   - provides selection (but not upload etc) of public images on Flickr
351 *    Set
352 *       $IMConfig['Flickr'] = array('Key' => 'yourkeyhere');
353 *    to turn on Flickr support.
354 *
355 *    To get a key: http://www.flickr.com/services/api/keys/
356 *
357 *    WARNING: Flickr restricts commercial use of the API.  If your site is in any way even
358 *     remotely commercial you need to ask for a commercial key from flickr.
359 *
360 *    ADDITIONAL WARNING: Flickr requires that you provide a link back to them, preferably
361 *     on the image itself (linking to the image) - you can use smart-image.js to do
362 *     something like this.
363 *
364 *    ADDITIONAL ADDITIONAL WARNING: It's up to you to comply with the image's license!!
365 */
366 
367$IMConfig['Local'] = TRUE;
368$IMConfig['YouTube']  = FALSE;
369$IMConfig['Flickr']   = FALSE;
370
371// These are some configurable defaults for Flickr, to override
372//  $IMConfig['Flickr'] = array('Whatever' => 'You Want');
373$FlickrDefaults = array
374(
375  // This is the URL as flickr provides it for the licence which you wish
376  // to search on by default.  The default here is the least restrictive one.
377  'Default License' => 'http://creativecommons.org/licenses/by/2.0/',
378   
379); 
380
381
382////////////////////////////////////////////////////////////////////////////////
383//       ================== END OF CONFIGURATION =======================      //
384////////////////////////////////////////////////////////////////////////////////
385
386
387// Standard PHP Backend Data Passing
388//  if data was passed using xinha_pass_to_php_backend() we merge the items
389//  provided into the Config
390require_once(realpath(dirname(__FILE__) . '/../../contrib/php-xinha.php'));
391if($passed_data = xinha_read_passed_data())
392{
393  $IMConfig = array_merge($IMConfig, $passed_data);
394  $IMConfig['backend_url'] .= xinha_passed_data_querystring() . '&';
395 
396  if($IMConfig['Flickr'])
397  {
398    foreach($FlickrDefaults as $k => $v)
399    {
400      if(!isset($IMConfig['Flickr'][$k]))
401      {
402        $IMConfig['Flickr'][$k] = $v;
403      }
404    }
405  }
406}
407// Deprecated config passing, don't use this way any more!
408elseif(isset($_REQUEST['backend_config']))
409{
410  if(get_magic_quotes_gpc()) {
411    $_REQUEST['backend_config'] = stripslashes($_REQUEST['backend_config']);
412  }
413 
414  if($_REQUEST['backend_config_secret_key_location'] !== 'Xinha:ImageManager')
415  {
416    trigger_error('Programming Error - please contact the website administrator/programmer to alert them to this problem. A non-default backend key location is being used to pass backend data to Xinha, but the same key location is not being used to receive data.  The special backend configuration has been ignored.  To resolve this, you should edit plugins/ImageManager/config.php and change the default key location from "Xinha:ImageManager" to your desired non default.  See: http://trac.xinha.org/ticket/1518', E_USER_ERROR);   
417  }
418  else
419  {
420 
421  // Config specified from front end, check that it's valid
422  session_start();
423  $secret = $_SESSION[$_REQUEST['backend_config_secret_key_location']];
424
425  if($_REQUEST['backend_config_hash'] !== sha1($_REQUEST['backend_config'] . $secret))
426  {
427    die("Backend security error.");
428  }
429
430  $to_merge = unserialize($_REQUEST['backend_config']);
431  if(!is_array($to_merge))
432  {
433    die("Backend config syntax error.");
434  }
435
436  $IMConfig = array_merge($IMConfig, $to_merge);
437  $IMConfig['backend_url'] .= "backend_config=" . rawurlencode($_REQUEST['backend_config']) . '&';
438  $IMConfig['backend_url'] .= "backend_config_hash=" . rawurlencode($_REQUEST['backend_config_hash']) . '&';
439  $IMConfig['backend_url'] .= "backend_config_secret_key_location=" . rawurlencode($_REQUEST['backend_config_secret_key_location']) . '&';
440  }
441}
442
443define('IMAGE_CLASS', $IMConfig['IMAGE_CLASS']);
444define('IMAGE_TRANSFORM_LIB_PATH', $IMConfig['IMAGE_TRANSFORM_LIB_PATH']);
445define( "IM_CONFIG_LOADED", "yes" );
446
447// bring in the debugging library
448
449include_once( "ddt.php" );
450
451// uncomment to send debug messages to a local file
452// _setDebugLog( "/tmp/debug_log.txt" );
453
454// turn debugging on everywhere.
455// _ddtOn();
456
457// END
458
459?>
Note: See TracBrowser for help on using the repository browser.