| [21] | 1 | <?php |
|---|
| 2 | include_once('RCCWP_CustomField.php'); |
|---|
| 3 | |
|---|
| 4 | class RCCWP_CreateCustomFieldPage |
|---|
| 5 | { |
|---|
| 6 | function Main() |
|---|
| 7 | { |
|---|
| 8 | global $FIELD_TYPES; |
|---|
| 9 | $customGroupID = $_REQUEST['custom-group-id']; |
|---|
| 10 | ?> |
|---|
| 11 | |
|---|
| 12 | <div class="wrap"> |
|---|
| 13 | |
|---|
| 14 | <h2>Create Custom Field</h2> |
|---|
| 15 | <br class="clear" /> |
|---|
| 16 | <?php |
|---|
| 17 | if (isset($_GET['err_msg'])) : |
|---|
| 18 | switch ($_GET['err_msg']){ |
|---|
| 19 | case -1: |
|---|
| 20 | ?> |
|---|
| 21 | <div class="error"><p> A field with the same name already exists in this write panel. Please choose a different name.</p></div> |
|---|
| 22 | <?php |
|---|
| 23 | } |
|---|
| 24 | endif; |
|---|
| 25 | ?> |
|---|
| 26 | |
|---|
| 27 | <form action="<?php echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('continue-create-custom-field')?>" method="post" name="create_custom_field_form" id="create-custom-field-form" onsubmit="return checkEmpty();" autocomplete="off"> |
|---|
| 28 | |
|---|
| 29 | <?php if(isset($_GET['custom-group-id']) && !empty($_GET['custom-group-id'])) { ?> |
|---|
| 30 | <input type="hidden" name="custom-group-id" value="<?php echo $_GET['custom-group-id']?>"> |
|---|
| 31 | <?php } ?> |
|---|
| 32 | <?php if(isset($_POST['custom-group-id']) && !empty($_POST['custom-group-id'])) { ?> |
|---|
| 33 | <input type="hidden" name="custom-group-id" value="<?php echo $_POST['custom-group-id']?>"> |
|---|
| 34 | |
|---|
| 35 | <?php } ?> |
|---|
| 36 | |
|---|
| 37 | |
|---|
| 38 | <table class="form-table" width="100%" border="0" cellspacing="0" cellpadding="6"> |
|---|
| 39 | <tbody> |
|---|
| 40 | <tr valign="top"> |
|---|
| 41 | <th scope="row">Name:</th> |
|---|
| 42 | <td> |
|---|
| 43 | <input name="custom-field-name" id="custom-field-name" size="40" type="text" onkeyup="ajax_showOptions(this,'getFieldsByLetters',event)"/> |
|---|
| 44 | <input type="hidden" id="custom-field-name_hidden" name="custom-field-name_hidden" onchange="copyField();"> |
|---|
| 45 | <p> |
|---|
| 46 | Type a unique name for the field, the name must be unique among all fields |
|---|
| 47 | in this panel. The name of the field is the key by which you can retrieve |
|---|
| 48 | the field value later. |
|---|
| 49 | </p> |
|---|
| 50 | <p> |
|---|
| 51 | As you type the name, Flutter will display fields from other |
|---|
| 52 | panels that are similar to the name you typed. If you selected one of them, |
|---|
| 53 | Flutter will create a field similar to the chosen one. |
|---|
| 54 | </p> |
|---|
| 55 | </td> |
|---|
| 56 | </tr> |
|---|
| 57 | |
|---|
| 58 | <tr valign="top"> |
|---|
| 59 | <th scope="row">Label:</th> |
|---|
| 60 | <td> |
|---|
| 61 | <input name="custom-field-description" id="custom-field-description" size="40" type="text" /> |
|---|
| 62 | <p> |
|---|
| 63 | Type a label for the field. The label of the field is displayed |
|---|
| 64 | beside the field in Write Panel page. |
|---|
| 65 | </p> |
|---|
| 66 | </td> |
|---|
| 67 | </tr> |
|---|
| 68 | |
|---|
| 69 | <tr valign="top"> |
|---|
| 70 | <th scope="row">Can be duplicated:</th> |
|---|
| 71 | <td><input name="custom-field-duplicate" id="custom-field-duplicate" type="checkbox" value="1" <?php echo $custom_field->duplicate==1 ? "checked":"" ?>/></td> |
|---|
| 72 | </tr> |
|---|
| 73 | |
|---|
| 74 | <tr valign="top"> |
|---|
| 75 | <th scope="row">Order:</th> |
|---|
| 76 | <td><input type="text" name="custom-field-order" id="custom-field-order" size="2" value="0" /></td> |
|---|
| 77 | </tr> |
|---|
| 78 | |
|---|
| 79 | |
|---|
| 80 | <tr valign="top"> |
|---|
| 81 | <th scope="row">Required:</th> |
|---|
| 82 | <td> |
|---|
| 83 | <select name="custom-field-required" id="custom-field-required"> |
|---|
| 84 | <option value="0" selected="selected">Not Required - can be empty</option> |
|---|
| 85 | <option value="1">Required - can not be empty</option> |
|---|
| 86 | </select> |
|---|
| 87 | </td> |
|---|
| 88 | </tr> |
|---|
| 89 | |
|---|
| 90 | <tr valign="top"> |
|---|
| 91 | <th scope="row">Type:</th> |
|---|
| 92 | <td> |
|---|
| 93 | |
|---|
| 94 | <!-- START :: Javascript for Image/Photo' Css Class and for check --> |
|---|
| 95 | <script type="text/javascript" language="javascript"> |
|---|
| 96 | submitForm = false; |
|---|
| 97 | function fun(name) |
|---|
| 98 | { |
|---|
| 99 | if(name == "Image") |
|---|
| 100 | { |
|---|
| 101 | document.getElementById('divLbl').style.display = 'inline'; |
|---|
| 102 | document.getElementById('divCSS').style.display = 'inline'; |
|---|
| 103 | } |
|---|
| 104 | else |
|---|
| 105 | { |
|---|
| 106 | document.getElementById('divLbl').style.display = 'none'; |
|---|
| 107 | document.getElementById('divCSS').style.display = 'none'; |
|---|
| 108 | } |
|---|
| 109 | } |
|---|
| 110 | |
|---|
| 111 | function checkEmpty() |
|---|
| 112 | { |
|---|
| 113 | if (submitForm && (document.getElementById('custom-field-name').value == "" || document.getElementById('custom-field-description').value == "")){ |
|---|
| 114 | alert("Please fill in the name and the label of the field"); |
|---|
| 115 | return false; |
|---|
| 116 | } |
|---|
| 117 | return true; |
|---|
| 118 | |
|---|
| 119 | } |
|---|
| 120 | </script> |
|---|
| 121 | <!-- END :: Javascript for Image/Photo' Css Class --> |
|---|
| 122 | |
|---|
| 123 | <?php |
|---|
| 124 | $field_types = RCCWP_CustomField::GetCustomFieldTypes(); |
|---|
| 125 | foreach ($field_types as $field) : |
|---|
| 126 | $checked = |
|---|
| 127 | $field->name == RCCWP_CustomField::GetDefaultCustomFieldType() ? |
|---|
| 128 | 'checked="checked"' : ''; |
|---|
| 129 | ?> |
|---|
| 130 | <label><input name="custom-field-type" value="<?php echo $field->id?>" type="radio" <?php echo $checked?> onclick='fun("<?php echo $field->name?>");' /> <!-- Calling Javascript Function --> |
|---|
| 131 | <?php echo $field->name?></label><br /> |
|---|
| 132 | <?php |
|---|
| 133 | endforeach; |
|---|
| 134 | ?> |
|---|
| 135 | </td> |
|---|
| 136 | </tr> |
|---|
| 137 | <!-- START :: For Image/Photo' Css --> |
|---|
| 138 | <tr valign="top"> |
|---|
| 139 | <th scope="row"><div id="divLbl" style="display:none">Css Class:</div></th> |
|---|
| 140 | <td> |
|---|
| 141 | <div id="divCSS" style="display:none"> |
|---|
| 142 | <input name="custom-field-css" id="custom-field-css" size="40" type="text" value="freshout" /> |
|---|
| 143 | </div> |
|---|
| 144 | </td> |
|---|
| 145 | </tr> |
|---|
| 146 | <!-- END :: For Image/Photo' Css --> |
|---|
| 147 | </tbody> |
|---|
| 148 | </table> |
|---|
| 149 | |
|---|
| 150 | |
|---|
| 151 | <p class="submit" > |
|---|
| 152 | <a style="color:black" href="<?php echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('cancel-create-custom-field')."&custom-group-id=$customGroupID"?>" class="button"><?php _e('Cancel'); ?></a> |
|---|
| 153 | <input type="submit" id="continue-create-custom-field" value="Continue" onclick="submitForm=true;"/> |
|---|
| 154 | </p> |
|---|
| 155 | |
|---|
| 156 | </form> |
|---|
| 157 | |
|---|
| 158 | </div> |
|---|
| 159 | |
|---|
| 160 | <?php |
|---|
| 161 | } |
|---|
| 162 | |
|---|
| 163 | function SetOptions() |
|---|
| 164 | { |
|---|
| 165 | $current_field = RCCWP_CustomField::GetCustomFieldTypes($_POST['custom-field-type']); |
|---|
| 166 | $customGroupID = $_REQUEST['custom-group-id']; |
|---|
| 167 | ?> |
|---|
| 168 | |
|---|
| 169 | <div class="wrap"> |
|---|
| 170 | |
|---|
| 171 | <h2>Create Custom Field</h2> |
|---|
| 172 | |
|---|
| 173 | <form action="<?php echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('finish-create-custom-field')?>" method="post" id="continue-create-new-field-form"> |
|---|
| 174 | |
|---|
| 175 | <input type="hidden" name="custom-group-id" value="<?php echo $_POST['custom-group-id']?>" /> |
|---|
| 176 | <input type="hidden" name="custom-field-name" value="<?php echo htmlspecialchars($_POST['custom-field-name'])?>" /> |
|---|
| 177 | <input type="hidden" name="custom-field-description" value="<?php echo htmlspecialchars($_POST['custom-field-description'])?>" /> |
|---|
| 178 | <input type="hidden" name="custom-field-duplicate" value="<?php echo htmlspecialchars($_POST['custom-field-duplicate'])?>" /> |
|---|
| 179 | <input type="hidden" name="custom-field-order" value="<?php echo $_POST['custom-field-order']?>" /> |
|---|
| 180 | <input type="hidden" name="custom-field-required" value="<?php echo $_POST['custom-field-required']?>" /> |
|---|
| 181 | <input type="hidden" name="custom-field-type" value="<?php echo $_POST['custom-field-type']?>" /> |
|---|
| 182 | |
|---|
| 183 | <!-- Hidden value for Image/Photo' Css Class--> |
|---|
| 184 | <input type="hidden" name="custom-field-css" value="<?php echo $_POST['custom-field-css']?>" /> |
|---|
| 185 | |
|---|
| 186 | <h3><?php echo $current_field->name?></h3> |
|---|
| 187 | |
|---|
| 188 | <table class="form-table" width="100%" border="0" cellspacing="0" cellpadding="6"> |
|---|
| 189 | <tbody> |
|---|
| 190 | |
|---|
| 191 | <?php |
|---|
| 192 | if ($current_field->has_properties == "true") : |
|---|
| 193 | ?> |
|---|
| 194 | |
|---|
| 195 | <?php |
|---|
| 196 | if (in_array($current_field->name, array('Textbox', 'Listbox'))) : |
|---|
| 197 | if ($current_field->name == 'Textbox') |
|---|
| 198 | $size = 25; |
|---|
| 199 | else if ($current_field->name == 'Listbox') |
|---|
| 200 | $size = 3; |
|---|
| 201 | ?> |
|---|
| 202 | <tr valign="top"> |
|---|
| 203 | <th scope="row">Size:</th> |
|---|
| 204 | <td><input type="text" name="custom-field-size" id="custom-field-size" size="2" value="<?php echo $size?>" /></td> |
|---|
| 205 | </tr> |
|---|
| 206 | <?php endif; ?> |
|---|
| 207 | |
|---|
| 208 | <?php |
|---|
| 209 | if (in_array($current_field->name, array('Multiline Textbox'))) : |
|---|
| 210 | $height = 3; |
|---|
| 211 | $width = 23; |
|---|
| 212 | ?> |
|---|
| 213 | <tr valign="top"> |
|---|
| 214 | <th scope="row">Height:</th> |
|---|
| 215 | <td><input type="text" name="custom-field-height" id="custom-field-height" size="2" value="<?php echo $height?>" /></td> |
|---|
| 216 | </tr> |
|---|
| 217 | <tr valign="top"> |
|---|
| 218 | <th scope="row">Width:</th> |
|---|
| 219 | <td><input type="text" name="custom-field-width" id="custom-field-width" size="2" value="<?php echo $width?>" /></td> |
|---|
| 220 | </tr> |
|---|
| 221 | <?php endif; ?> |
|---|
| 222 | |
|---|
| 223 | <?php |
|---|
| 224 | endif; // has_properties |
|---|
| 225 | ?> |
|---|
| 226 | |
|---|
| 227 | <?php |
|---|
| 228 | if ($current_field->has_options == "true") : |
|---|
| 229 | ?> |
|---|
| 230 | <tr valign="top"> |
|---|
| 231 | <th scope="row">Options:</th> |
|---|
| 232 | <td> |
|---|
| 233 | <textarea name="custom-field-options" id="custom-field-options" rows="2" cols="38"></textarea><br /> |
|---|
| 234 | <em>Separate each option with a newline.</em> |
|---|
| 235 | </td> |
|---|
| 236 | </tr> |
|---|
| 237 | <tr valign="top"> |
|---|
| 238 | <th scope="row">Default Value:</th> |
|---|
| 239 | <td> |
|---|
| 240 | <?php |
|---|
| 241 | if ($current_field->allow_multiple_values == "true") : |
|---|
| 242 | ?> |
|---|
| 243 | <textarea name="custom-field-default-value" id="custom-field-default-value" rows="2" cols="38"></textarea><br /> |
|---|
| 244 | <em>Separate each value with a newline.</em> |
|---|
| 245 | <?php |
|---|
| 246 | else : |
|---|
| 247 | ?> |
|---|
| 248 | <input type="text" name="custom-field-default-value" id="custom-field-default-value" size="25" /> |
|---|
| 249 | <?php |
|---|
| 250 | endif; |
|---|
| 251 | ?> |
|---|
| 252 | </td> |
|---|
| 253 | </tr> |
|---|
| 254 | <?php endif; ?> |
|---|
| 255 | |
|---|
| 256 | |
|---|
| 257 | <?php if( $current_field->has_properties && $current_field->name == 'Image' ) : ?> |
|---|
| 258 | <tr valign="top"> |
|---|
| 259 | <th scope="row">Options:</th> |
|---|
| 260 | <td> |
|---|
| 261 | Max Height: <input type="text" name="custom-field-photo-height" id="custom-field-photo-height"/> |
|---|
| 262 | Max Width: <input type="text" name="custom-field-photo-width" id="custom-field-photo-width" /> |
|---|
| 263 | Custom: <input type="text" name="custom-field-custom-params" id="custom-field-custom-params" /> |
|---|
| 264 | <div style="color:blue;text-decoration:underline;" |
|---|
| 265 | onclick="div=document.getElementById('params');div.style.display='';" |
|---|
| 266 | > |
|---|
| 267 | Custom Options List |
|---|
| 268 | </div> |
|---|
| 269 | <div id="params" |
|---|
| 270 | style="display:none;" |
|---|
| 271 | onclick="this.style.display='none';"> |
|---|
| 272 | <pre><?php echo param_list(); ?></pre> |
|---|
| 273 | </div> |
|---|
| 274 | </td> |
|---|
| 275 | </tr> |
|---|
| 276 | <?php endif; ?> |
|---|
| 277 | |
|---|
| 278 | <!-- Date Custom Field --> |
|---|
| 279 | <?php if( $current_field->has_properties && $current_field->name == 'Date' ) : ?> |
|---|
| 280 | <tr valign="top"> |
|---|
| 281 | <th scope="row">Options:</th> |
|---|
| 282 | <td> |
|---|
| 283 | Format: <select name="custom-field-date-format" id="custom-field-date-format"> |
|---|
| 284 | <option value="m/d/Y">4/20/2008</option> |
|---|
| 285 | <option value="l, F d, Y">Sunday, April 20, 2008</option> |
|---|
| 286 | <option value="F d, Y">April 20, 2008</option> |
|---|
| 287 | <option value="m/d/y">4/20/08</option> |
|---|
| 288 | <option value="Y-m-d">2008-04-20</option> |
|---|
| 289 | <option value="d-M-y">20-Apr-08</option> |
|---|
| 290 | <option value="m.d.Y">4.20.2008</option> |
|---|
| 291 | <option value="m.d.y">4.20.08</option> |
|---|
| 292 | </select> |
|---|
| 293 | </td> |
|---|
| 294 | </tr> |
|---|
| 295 | <?php endif; ?> |
|---|
| 296 | <!-- Date Custom Field --> |
|---|
| 297 | |
|---|
| 298 | </tbody> |
|---|
| 299 | </table> |
|---|
| 300 | |
|---|
| 301 | <p class="submit" > |
|---|
| 302 | <a style="color:black" href="<?php echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('cancel-create-custom-field')."&custom-group-id=$customGroupID"?>" class="button"><?php _e('Cancel'); ?></a> |
|---|
| 303 | <input type="submit" id="finish-create-custom-field" value="Finish" /> |
|---|
| 304 | </p> |
|---|
| 305 | |
|---|
| 306 | </form> |
|---|
| 307 | |
|---|
| 308 | </div> |
|---|
| 309 | |
|---|
| 310 | <?php |
|---|
| 311 | } |
|---|
| 312 | |
|---|
| 313 | function AddAjaxDynamicList(){ |
|---|
| 314 | if($_GET['flutter_action']=='create-custom-field'){ |
|---|
| 315 | ?> |
|---|
| 316 | <style type="text/css"> |
|---|
| 317 | /* Big box with list of options */ |
|---|
| 318 | #ajax_listOfOptions{ |
|---|
| 319 | position:absolute; /* Never change this one */ |
|---|
| 320 | width:375px; /* Width of box */ |
|---|
| 321 | height:250px; /* Height of box */ |
|---|
| 322 | overflow:auto; /* Scrolling features */ |
|---|
| 323 | border:1px solid #317082; /* Dark green border */ |
|---|
| 324 | background-color:#FFF; /* White background color */ |
|---|
| 325 | text-align:left; |
|---|
| 326 | font-size:0.9em; |
|---|
| 327 | z-index:100; |
|---|
| 328 | } |
|---|
| 329 | #ajax_listOfOptions div{ /* General rule for both .optionDiv and .optionDivSelected */ |
|---|
| 330 | margin:1px; |
|---|
| 331 | padding:1px; |
|---|
| 332 | cursor:pointer; |
|---|
| 333 | font-size:0.9em; |
|---|
| 334 | } |
|---|
| 335 | #ajax_listOfOptions .optionDiv{ /* Div for each item in list */ |
|---|
| 336 | |
|---|
| 337 | } |
|---|
| 338 | #ajax_listOfOptions .optionDivSelected{ /* Selected item in the list */ |
|---|
| 339 | background-color:#317082; |
|---|
| 340 | color:#FFF; |
|---|
| 341 | } |
|---|
| 342 | #ajax_listOfOptions_iframe{ |
|---|
| 343 | background-color:#F00; |
|---|
| 344 | position:absolute; |
|---|
| 345 | z-index:5; |
|---|
| 346 | } |
|---|
| 347 | |
|---|
| 348 | form{ |
|---|
| 349 | display:inline; |
|---|
| 350 | } |
|---|
| 351 | |
|---|
| 352 | </style> |
|---|
| 353 | <script type="text/javascript"> |
|---|
| 354 | var flutter_path = "<?php echo FLUTTER_URI ?>" ; |
|---|
| 355 | var panel_id = "<?php echo $_REQUEST['custom-write-panel-id']; ?>" ; |
|---|
| 356 | |
|---|
| 357 | function copyField(){ |
|---|
| 358 | selectedFieldId = document.create_custom_field_form.elements['custom-field-name_hidden'].value; |
|---|
| 359 | window.location = "<?php echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('copy-custom-field')."&custom-group-id=".$_REQUEST['custom-group-id']?>&custom-field-id="+selectedFieldId; |
|---|
| 360 | } |
|---|
| 361 | |
|---|
| 362 | </script> |
|---|
| 363 | <script type="text/javascript" src="<?php echo FLUTTER_URI?>js/ajax-dynamic-list/ajax.js"></script> |
|---|
| 364 | <script type="text/javascript" src="<?php echo FLUTTER_URI?>js/ajax-dynamic-list/ajax-dynamic-list.js"> |
|---|
| 365 | /************************************************************************************************************ |
|---|
| 366 | (C) www.dhtmlgoodies.com, April 2006 |
|---|
| 367 | |
|---|
| 368 | This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website. |
|---|
| 369 | |
|---|
| 370 | Terms of use: |
|---|
| 371 | You are free to use this script as long as the copyright message is kept intact. However, you may not |
|---|
| 372 | redistribute, sell or repost it without our permission. |
|---|
| 373 | |
|---|
| 374 | Thank you! |
|---|
| 375 | |
|---|
| 376 | www.dhtmlgoodies.com |
|---|
| 377 | Alf Magne Kalleland |
|---|
| 378 | |
|---|
| 379 | ************************************************************************************************************/ |
|---|
| 380 | </script> |
|---|
| 381 | |
|---|
| 382 | <?php |
|---|
| 383 | } |
|---|
| 384 | } |
|---|
| 385 | |
|---|
| 386 | } //end class |
|---|
| 387 | |
|---|
| 388 | function param_list() |
|---|
| 389 | { |
|---|
| 390 | return ' |
|---|
| 391 | src = filename of source image |
|---|
| 392 | new = create new image, not thumbnail of existing image. |
|---|
| 393 | Requires "w" and "h" parameters set. |
|---|
| 394 | [ex: &new=FF0000|75] - red background, 75% opacity |
|---|
| 395 | Set to hex color string of background. Opacity is |
|---|
| 396 | optional (defaults to 100% opaque). |
|---|
| 397 | w = max width of output thumbnail in pixels |
|---|
| 398 | h = max height of output thumbnail in pixels |
|---|
| 399 | wp = max width for portrait images |
|---|
| 400 | hp = max height for portrait images |
|---|
| 401 | wl = max width for landscape images |
|---|
| 402 | hl = max height for landscape images |
|---|
| 403 | ws = max width for square images |
|---|
| 404 | hs = max height for square images |
|---|
| 405 | f = output image format ("jpeg", "png", or "gif") |
|---|
| 406 | q = JPEG compression (1=worst, 95=best, 75=default) |
|---|
| 407 | sx = left side of source rectangle (default = 0) |
|---|
| 408 | (values 0 < sx < 1 represent percentage) |
|---|
| 409 | sy = top side of source rectangle (default = 0) |
|---|
| 410 | (values 0 < sy < 1 represent percentage) |
|---|
| 411 | sw = width of source rectangle (default = fullwidth) |
|---|
| 412 | (values 0 < sw < 1 represent percentage) |
|---|
| 413 | sh = height of source rectangle (default = fullheight) |
|---|
| 414 | (values 0 < sh < 1 represent percentage) |
|---|
| 415 | zc = zoom-crop. Will auto-crop off the larger dimension |
|---|
| 416 | so that the image will fill the smaller dimension |
|---|
| 417 | (requires both "w" and "h", overrides "iar", "far") |
|---|
| 418 | Set to "1" or "C" to zoom-crop towards the center, |
|---|
| 419 | or set to "T", "B", "L", "R", "TL", "TR", "BL", "BR" |
|---|
| 420 | to gravitate towards top/left/bottom/right directions |
|---|
| 421 | (requies ImageMagick for values other than "C" or "1") |
|---|
| 422 | bg = background hex color (default = FFFFFF) |
|---|
| 423 | bc = border hex color (default = 000000) |
|---|
| 424 | fltr = filter system. Call as an array as follows: |
|---|
| 425 | - "brit" (Brightness) [ex: &fltr[]=brit|<value] |
|---|
| 426 | where <value is the amount +/- to adjust brightness |
|---|
| 427 | (range -255 to 255) |
|---|
| 428 | Availble in PHP5 with bundled GD only. |
|---|
| 429 | - "cont" (Constrast) [ex: &fltr[]=cont|<value>] |
|---|
| 430 | where <value is the amount +/- to adjust contrast |
|---|
| 431 | (range -255 to 255) |
|---|
| 432 | Availble in PHP5 with bundled GD only. |
|---|
| 433 | - "gam" (Gamma Correction) [ex: |
|---|
| 434 | &fltr[]=gam|<value>] |
|---|
| 435 | where <value> can be a number >0 to 10+ (default 1.0) |
|---|
| 436 | Must be >0 (zero gives no effect). There is no max, |
|---|
| 437 | although beyond 10 is pretty useless. Negative |
|---|
| 438 | numbers actually do something, maybe not quite the |
|---|
| 439 | desired effect, but interesting nonetheless. |
|---|
| 440 | - "sat" (SATuration) [ex: &fltr[]=sat|<value>] |
|---|
| 441 | where <value> is a number between zero (no change) |
|---|
| 442 | and -100 (complete desaturation = grayscale), or it |
|---|
| 443 | can be any positive number for increased saturation. |
|---|
| 444 | - "ds" (DeSaturate) [ex: &fltr[]=ds|<value>] |
|---|
| 445 | is an alias for "sat" except values are inverted |
|---|
| 446 | (positive values remove color, negative values boost |
|---|
| 447 | saturation) |
|---|
| 448 | - "gray" (Grayscale) [ex: &fltr[]=gray] |
|---|
| 449 | remove all color from image, make it grayscale |
|---|
| 450 | - "th" (Threshold) [ex: &fltr[]=th|<value>] |
|---|
| 451 | makes image greyscale, then sets all pixels brighter |
|---|
| 452 | than <value> (range 0-255) to white, and all pixels |
|---|
| 453 | darker than <value> to black |
|---|
| 454 | - "rcd" (Reduce Color Depth) [ex: |
|---|
| 455 | &fltr[]=rcd|<c>|<d>] |
|---|
| 456 | where <c> is the number of colors (2-256) you want |
|---|
| 457 | in the output image, and <d> is "1" for dithering |
|---|
| 458 | (deault) or "0" for no dithering |
|---|
| 459 | - "clr" (Colorize) [ex: |
|---|
| 460 | &fltr[]=clr|<value>|<color>] |
|---|
| 461 | where <value> is a number between 0 and 100 for the |
|---|
| 462 | amount of colorization, and <color> is the hex color |
|---|
| 463 | to colorize to. |
|---|
| 464 | - "sep" (Sepia) [ex: |
|---|
| 465 | &fltr[]=sep|<value>|<color>] |
|---|
| 466 | where <value> is a number between 0 and 100 for the |
|---|
| 467 | amount of colorization (default=50), and <color> is |
|---|
| 468 | the hex color to colorize to (default=A28065). |
|---|
| 469 | Note: this behaves differently when applied by |
|---|
| 470 | ImageMagick, in which case 80 is default, and lower |
|---|
| 471 | values give brighter/yellower images and higher |
|---|
| 472 | values give darker/bluer images |
|---|
| 473 | - "usm" (UnSharpMask) [ex: |
|---|
| 474 | &fltr[]=usm|<a>|<r>|<t>] |
|---|
| 475 | where <a> is the amount (default = 80), <r> is the |
|---|
| 476 | radius (default = 0.5), <t> is the threshold |
|---|
| 477 | (default = 3). |
|---|
| 478 | - "blur" (Blur) [ex: &fltr[]=blur|<radius>] |
|---|
| 479 | where (0 < <radius> < 25) (default = 1) |
|---|
| 480 | - "gblr" (Gaussian Blur) [ex: &fltr[]=gblr] |
|---|
| 481 | Availble in PHP5 with bundled GD only. |
|---|
| 482 | - "sblr" (Selective Blur) [ex: &fltr[]=gblr] |
|---|
| 483 | Availble in PHP5 with bundled GD only. |
|---|
| 484 | - "smth" (Smooth) [ex: &fltr[]=smth|<value>] |
|---|
| 485 | where <value> is the weighting value for the matrix |
|---|
| 486 | (range -10 to 10, default 6) |
|---|
| 487 | Availble in PHP5 with bundled GD only. |
|---|
| 488 | - "lvl" (Levels) |
|---|
| 489 | [ex: &fltr[]=lvl|<channel>|<method>|<threshol>d |
|---|
| 490 | where <channel> can be one of "r", "g", "b", "a" (for |
|---|
| 491 | Red, Green, Blue, Alpha respectively), or "*" for all |
|---|
| 492 | RGB channels (default) based on grayscale average. |
|---|
| 493 | ImageMagick methods can support multiple channels |
|---|
| 494 | (eg "lvl|rg|3") but internal methods cannot (they will |
|---|
| 495 | use first character of channel string as channel) |
|---|
| 496 | <method> can be one of: |
|---|
| 497 | 0=Internal RGB; |
|---|
| 498 | 1=Internal Grayscale; |
|---|
| 499 | 2=ImageMagick Contrast-Stretch (default) |
|---|
| 500 | 3=ImageMagick Normalize (may appear over-saturated) |
|---|
| 501 | <threshold> is how much of brightest/darkest pixels |
|---|
| 502 | will be clipped in percent (default = 0.1%) |
|---|
| 503 | Using default parameters (&fltr[]=lvl) is similar to |
|---|
| 504 | Auto Contrast in Adobe Photoshop. |
|---|
| 505 | - "wb" (White Balance) [ex: &fltr[]=wb|<c>] |
|---|
| 506 | where <c> is the target hex color to white balance |
|---|
| 507 | on, this color is what "should be" white, or light |
|---|
| 508 | gray. The filter attempts to maintain brightness so |
|---|
| 509 | any gray color can theoretically be used. If <c> is |
|---|
| 510 | omitted the filter guesses based on brightest pixels |
|---|
| 511 | in each of RGB |
|---|
| 512 | OR <c> can be the percent of white clipping used |
|---|
| 513 | to calculate auto-white-balance (default = 0.1%) |
|---|
| 514 | NOTE: "wb" in default settings already gives an effect |
|---|
| 515 | similar to "lvl", there is usually no need to use "lvl" |
|---|
| 516 | if "wb" is already used. |
|---|
| 517 | - "hist" (Histogram) |
|---|
| 518 | [ex: &fltr[]=hist|<b>|<c>|<w>|<h>|<a>|<o>|<x>|<y>] |
|---|
| 519 | Where <b> is the color band(s) to display, from back |
|---|
| 520 | to front (one or more of "rgba*" for Red Green Blue |
|---|
| 521 | Alpha and Grayscale respectively); |
|---|
| 522 | <c> is a semicolon-seperated list of hex colors to |
|---|
| 523 | use for each graph band (defaults to FF0000, 00FF00, |
|---|
| 524 | 0000FF, 999999, FFFFFF respectively); |
|---|
| 525 | <w> and <h> are the width and height of the overlaid |
|---|
| 526 | histogram in pixels, or if <= 1 then percentage of |
|---|
| 527 | source image width/height; |
|---|
| 528 | <a> is the alignment (same as for "wmi" and "wmt"); |
|---|
| 529 | <o> is opacity from 0 (transparent) to 100 (opaque) |
|---|
| 530 | (requires PHP v4.3.2, otherwise 100% opaque); |
|---|
| 531 | <x> and <y> are the edge margin in pixels (or percent |
|---|
| 532 | if 0 < (x|y) < 1) |
|---|
| 533 | - "over" (OVERlay/underlay image) overlays an image on |
|---|
| 534 | the thumbnail, or overlays the thumbnail on another |
|---|
| 535 | image (to create a picture frame for example) |
|---|
| 536 | [ex: &fltr[]=over|<i>|<u>|<m>|<o>] |
|---|
| 537 | where <i> is the image filename; <u> is "0" (default) |
|---|
| 538 | for overlay the image on top of the thumbnail or "1" |
|---|
| 539 | for overlay the thumbnail on top of the image; <m> is |
|---|
| 540 | the margin - can be absolute pixels, or if < 1 is a |
|---|
| 541 | percentage of the thumbnail size [must be < 0.5] |
|---|
| 542 | (default is 0 for overlay and 10% for underlay); |
|---|
| 543 | <o> is opacity (0 = transparent, 100 = opaque) |
|---|
| 544 | (requires PHP v4.3.2, otherwise 100% opaque); |
|---|
| 545 | (thanks raynerapeᅵgmail*com, shabazz3ᅵmsu*edu) |
|---|
| 546 | - "wmi" (WaterMarkImage) |
|---|
| 547 | [ex: &fltr[]=wmi|<f>|<a>|<o>|<x>|<y>|<r>] where |
|---|
| 548 | <f> is the filename of the image to overlay; |
|---|
| 549 | <a> is the alignment (one of BR, BL, TR, TL, C, |
|---|
| 550 | R, L, T, B, *) where B=bottom, T=top, L=left, |
|---|
| 551 | R=right, C=centre, *=tile) |
|---|
| 552 | *or* |
|---|
| 553 | an absolute position in pixels (from top-left |
|---|
| 554 | corner of canvas to top-left corner of overlay) |
|---|
| 555 | in format {xoffset}x{yoffset} (eg: "10x20") |
|---|
| 556 | note: this is center position of image if <>x |
|---|
| 557 | and <y> are set |
|---|
| 558 | <o> is opacity from 0 (transparent) to 100 (opaque) |
|---|
| 559 | (requires PHP v4.3.2, otherwise 100% opaque); |
|---|
| 560 | <x> and <y> are the edge (and inter-tile) margin in |
|---|
| 561 | pixels (or percent if 0 < (x|y) < 1) |
|---|
| 562 | *or* |
|---|
| 563 | if <a> is absolute-position format then <x> and |
|---|
| 564 | <y> represent maximum width and height that the |
|---|
| 565 | watermark image will be scaled to fit inside |
|---|
| 566 | <r> is rotation angle of overlaid watermark |
|---|
| 567 | - "wmt" (WaterMarkText) |
|---|
| 568 | [ex: &fltr[]=wmt|<t>|<s>|<a>|<c>|<f>|<o>|<m>|<n>|<b>|<O>|<x>] |
|---|
| 569 | where: |
|---|
| 570 | <t> is the text to use as a watermark; |
|---|
| 571 | URLencoded Unicode HTMLentities must be used for |
|---|
| 572 | characters beyond chr(127). For example, the |
|---|
| 573 | "eighth note" character (U+266A) is represented |
|---|
| 574 | as "♪" and then urlencoded to "%26%239834%3B" |
|---|
| 575 | Any instance of metacharacters will be replaced |
|---|
| 576 | with their calculated value. Currently supported: |
|---|
| 577 | ^Fb = source image filesize in bytes |
|---|
| 578 | ^Fk = source image filesize in kilobytes |
|---|
| 579 | ^Fm = source image filesize in megabytes |
|---|
| 580 | ^X = source image width in pixels |
|---|
| 581 | ^Y = source image height in pixels |
|---|
| 582 | ^x = thumbnail width in pixels |
|---|
| 583 | ^y = thumbnail height in pixels |
|---|
| 584 | ^^ = the character ^ |
|---|
| 585 | <s> is the font size (1-5 for built-in font, or point |
|---|
| 586 | size for TrueType fonts); |
|---|
| 587 | <a> is the alignment (one of BR, BL, TR, TL, C, R, L, |
|---|
| 588 | T, B, * where B=bottom, T=top, L=left, R=right, |
|---|
| 589 | C=centre, *=tile); |
|---|
| 590 | *or* |
|---|
| 591 | an absolute position in pixels (from top-left |
|---|
| 592 | corner of canvas to top-left corner of overlay) |
|---|
| 593 | in format {xoffset}x{yoffset} (eg: "10x20") |
|---|
| 594 | <c> is the hex color of the text; |
|---|
| 595 | <f> is the filename of the TTF file (optional, if |
|---|
| 596 | omitted a built-in font will be used); |
|---|
| 597 | <o> is opacity from 0 (transparent) to 100 (opaque) |
|---|
| 598 | (requires PHP v4.3.2, otherwise 100% opaque); |
|---|
| 599 | <m> is the edge (and inter-tile) margin in percent; |
|---|
| 600 | <n> is the angle |
|---|
| 601 | <b> is the hex color of the background; |
|---|
| 602 | <O> is background opacity from 0 (transparent) to |
|---|
| 603 | 100 (opaque) |
|---|
| 604 | (requires PHP v4.3.2, otherwise 100% opaque); |
|---|
| 605 | <x> is the direction(s) in which the background is |
|---|
| 606 | extended (either "x" or "y" (or both, but both |
|---|
| 607 | will obscure entire image)) |
|---|
| 608 | Note: works with TTF fonts only, not built-in |
|---|
| 609 | - "flip" [ex: &fltr[]=flip|x or &fltr[]=flip|y] |
|---|
| 610 | flip image on X or Y axis |
|---|
| 611 | - "ric" [ex: &fltr[]=ric|<x>|<y>] |
|---|
| 612 | rounds off the corners of the image (to transparent |
|---|
| 613 | for PNG output), where <x> is the horizontal radius |
|---|
| 614 | of the curve and <y> is the vertical radius |
|---|
| 615 | - "elip" [ex: &fltr[]=elip] |
|---|
| 616 | similar to rounded corners but more extreme |
|---|
| 617 | - "mask" [ex: &fltr[]=mask|filename.png] |
|---|
| 618 | greyscale values of mask are applied as the alpha |
|---|
| 619 | channel to the main image. White is opaque, black |
|---|
| 620 | is transparent. |
|---|
| 621 | - "bvl" (BeVeL) [ex: |
|---|
| 622 | &fltr[]=bvl|<w>|<c1>|<c2>] |
|---|
| 623 | where <w> is the bevel width, <c1> is the hex color |
|---|
| 624 | for the top and left shading, <c2> is the hex color |
|---|
| 625 | for the bottom and right shading |
|---|
| 626 | - "bord" (BORDer) [ex: |
|---|
| 627 | &fltr[]=bord|<w>|<rx>|<ry>|<>c |
|---|
| 628 | where <w> is the width in pixels, <rx> |
|---|
| 629 | and <ry> are |
|---|
| 630 | horizontal and vertical radii for rounded corners, |
|---|
| 631 | and <c> is the hex color of the border |
|---|
| 632 | - "fram" (FRAMe) draws a frame, similar to "bord" but |
|---|
| 633 | more configurable |
|---|
| 634 | [ex: &fltr[]=fram|<w1>|<w2>|<c1>|<c2>|<c3>] |
|---|
| 635 | where <w1> is the width of the main border, |
|---|
| 636 | <w2> is |
|---|
| 637 | the width of each side of the bevel part, <c1> is the |
|---|
| 638 | hex color of the main border, <c2> is the highlight |
|---|
| 639 | bevel color, <c3> is the shadow bevel color |
|---|
| 640 | - "drop" (DROP shadow) |
|---|
| 641 | [ex: &fltr[]=drop|<d>|<w>|<clr>|<a>] |
|---|
| 642 | where <d> is distance from image to shadow, |
|---|
| 643 | <w> is |
|---|
| 644 | width of shadow fade (not yet implemented), |
|---|
| 645 | <clr> is |
|---|
| 646 | the hex color of the shadow, and <a> is the angle of |
|---|
| 647 | the shadow (default=225) |
|---|
| 648 | - "crop" (CROP image) |
|---|
| 649 | [ex: |
|---|
| 650 | &fltr[]=crop|<l>|<r>|<t>|<b>] |
|---|
| 651 | where <l> is the number of pixels to crop from the left |
|---|
| 652 | side of the resized image; <r>, <t>, |
|---|
| 653 | <b> are for right, |
|---|
| 654 | top and bottom respectively. Where (0 < x < 1) the |
|---|
| 655 | value will be used as a percentage of width/height. |
|---|
| 656 | Left and top crops take precedence over right and |
|---|
| 657 | bottom values. Cropping will be limited such that at |
|---|
| 658 | least 1 pixel of width and height always remains. |
|---|
| 659 | - "rot" (ROTate) |
|---|
| 660 | [ex: &fltr[]=rot|<a>|<b>] |
|---|
| 661 | where <a> is the rotation angle in degrees; |
|---|
| 662 | <b> is the |
|---|
| 663 | background hex color. Similar to regular "ra" parameter |
|---|
| 664 | but is applied in filter order after regular processing |
|---|
| 665 | so you can rotate output of other filters. |
|---|
| 666 | - "size" (reSIZE) |
|---|
| 667 | [ex: &fltr[]=size|<x>|<y>|<s>] |
|---|
| 668 | where <x> is the horizontal dimension in pixels, |
|---|
| 669 | <y> is |
|---|
| 670 | the vertical dimension in pixels, <s> is boolean whether |
|---|
| 671 | to stretch (if 1) or resize proportionately (0, default) |
|---|
| 672 | <x> and <y> will be interpreted as percentage of current |
|---|
| 673 | output image size if values are (0 < X < 1) |
|---|
| 674 | NOTE: do NOT use this filter unless absolutely neccesary. |
|---|
| 675 | It is only provided for cases where other filters need to |
|---|
| 676 | have absolute positioning based on source image and the |
|---|
| 677 | resultant image should be resized after other filters are |
|---|
| 678 | applied. This filter is less efficient than the standard |
|---|
| 679 | resizing procedures. |
|---|
| 680 | - "stc" (Source Transparent Color) |
|---|
| 681 | [ex: &fltr[]=stc|<c>|<n>|<x>] |
|---|
| 682 | where <c> is the hex color of the target color to be made |
|---|
| 683 | transparent; <n> is the minimum threshold in percent (all |
|---|
| 684 | pixels within <n>% of the target color will be 100% |
|---|
| 685 | transparent, default <n>=5); <x> is the maximum threshold |
|---|
| 686 | in percent (all pixels more than <x>% from the target |
|---|
| 687 | color will be 100% opaque, default <x>=10); pixels between |
|---|
| 688 | the two thresholds will be partially transparent. |
|---|
| 689 | md5s = MD5 hash of the source image -- if this parameter is |
|---|
| 690 | passed with the hash of the source image then the |
|---|
| 691 | source image is not checked for existance or |
|---|
| 692 | modification and the cached file is used (if |
|---|
| 693 | available). If "md5s" is passed an empty string then |
|---|
| 694 | phpThumb.php dies and outputs the correct MD5 hash |
|---|
| 695 | value. This parameter is the single-file equivalent |
|---|
| 696 | of "cache_source_filemtime_ignore_*" configuration |
|---|
| 697 | paramters |
|---|
| 698 | xto = EXIF Thumbnail Only - set to only extract EXIF |
|---|
| 699 | thumbnail and not do any additional processing |
|---|
| 700 | ra = Rotate by Angle: angle of rotation in degrees |
|---|
| 701 | positive = counterclockwise, negative = clockwise |
|---|
| 702 | ar = Auto Rotate: set to "x" to use EXIF orientation |
|---|
| 703 | stored by camera. Can also be set to "l" or "L" |
|---|
| 704 | for landscape, or "p" or "P" for portrait. "l" |
|---|
| 705 | and "P" rotate the image clockwise, "L" and "p" |
|---|
| 706 | rotate the image counter-clockwise. |
|---|
| 707 | sfn = Source Frame Number - use this frame/page number for |
|---|
| 708 | multi-frame/multi-page source images (GIF, TIFF, etc) |
|---|
| 709 | aoe = Output Allow Enlarging - override the setting for |
|---|
| 710 | $CONFIG["output_allow_enlarging"] (1=on, 0=off) |
|---|
| 711 | ("far" and "iar" both override this and allow output |
|---|
| 712 | larger than input) |
|---|
| 713 | iar = Ignore Aspect Ratio - disable proportional resizing |
|---|
| 714 | and stretch image to fit "h" & "w" (which must both |
|---|
| 715 | be set). (1=on, 0=off) (overrides "far") |
|---|
| 716 | far = Force Aspect Ratio - image will be created at size |
|---|
| 717 | specified by "w" and "h" (which must both be set). |
|---|
| 718 | Alignment: L=left,R=right,T=top,B=bottom,C=center |
|---|
| 719 | BL,BR,TL,TR use the appropriate direction if the |
|---|
| 720 | image is landscape or portrait. |
|---|
| 721 | dpi = Dots Per Inch - input DPI setting when importing from |
|---|
| 722 | vector image format such as PDF, WMF, etc |
|---|
| 723 | sia = Save Image As - default filename to save generated |
|---|
| 724 | image as. Specify the base filename, the extension |
|---|
| 725 | (eg: ".png") will be automatically added |
|---|
| 726 | maxb = MAXimum Byte size - output quality is auto-set to |
|---|
| 727 | fit thumbnail into "maxb" bytes (compression |
|---|
| 728 | quality is adjusted for JPEG, bit depth is adjusted |
|---|
| 729 | for PNG and GIF) |
|---|
| 730 | down = filename to save image to. If this is set the |
|---|
| 731 | browser will prompt to save to this filename rather |
|---|
| 732 | than display the image |
|---|
| 733 | |
|---|
| 734 | '; |
|---|
| 735 | } |
|---|
| 736 | |
|---|
| 737 | |
|---|
| 738 | |
|---|
| 739 | |
|---|
| 740 | ?> |
|---|