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