Ticket #25832: 25832.diff
File 25832.diff, 4.2 KB (added by , 11 years ago) |
---|
-
src/wp-admin/includes/image.php
102 102 $sizes[$s]['crop'] = get_option( "{$s}_crop" ); // For default sizes set in options 103 103 } 104 104 105 /** 106 * Filter the image sizes automatically generated when uploading an image. 107 * 108 * @since 2.9.0 109 * 110 * @param array $sizes Array of image sizes. 111 */ 105 112 $sizes = apply_filters( 'intermediate_image_sizes_advanced', $sizes ); 106 113 107 114 if ( $sizes ) { … … 155 162 if ( isset( $metadata['image']['data'] ) ) 156 163 unset( $metadata['image']['data'] ); 157 164 165 /** 166 * Filter the generated attachment metadata. 167 * 168 * @since 2.1.0 169 * 170 * @param array $metadata Array of attachment metadata. 171 * @param int $attachment_id Current attachment ID. 172 */ 158 173 return apply_filters( 'wp_generate_attachment_metadata', $metadata, $attachment_id ); 159 174 } 160 175 … … 268 283 } 269 284 } 270 285 271 // fetch additional info from exif if available 286 /** 287 * Filter the image types to check for exif data. 288 * 289 * @since 2.5.0 290 * 291 * @param array $imasge_types Image types to check for exit data. 292 */ 272 293 if ( is_callable( 'exif_read_data' ) && in_array( $sourceImageType, apply_filters( 'wp_read_image_metadata_types', array( IMAGETYPE_JPEG, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM ) ) ) ) { 273 294 $exif = @exif_read_data( $file ); 274 295 … … 316 337 $meta[ $key ] = utf8_encode( $meta[ $key ] ); 317 338 } 318 339 340 /** 341 * Filter the array of meta data read from an image's exif data. 342 * 343 * @since 2.5.0 344 * 345 * @param array $meta Image metadata. 346 * @param string $file Path to image file. 347 * @param int $sourceImageType Type of image. 348 */ 319 349 return apply_filters( 'wp_read_image_metadata', $meta, $file, $sourceImageType ); 320 350 321 351 } … … 351 381 else 352 382 $result = true; 353 383 384 /** 385 * Filter whether the current image is displayable in the browser. 386 * 387 * @since 2.5.0 388 * 389 * @param bool $result Whether or not the image can be displayed. Default false. 390 * @param string $path Path to the image. 391 */ 354 392 return apply_filters('file_is_displayable_image', $result, $path); 355 393 } 356 394 … … 384 422 break; 385 423 } 386 424 if ( is_resource($image) ) { 425 426 /** 427 * Filter the current image being loaded for editing. 428 * 429 * @since 2.9.0 430 * 431 * @param resource $image Current image. 432 * @param string $attachment_id Attachment ID. 433 * @param string $size Size of the image. 434 */ 387 435 $image = apply_filters('load_image_to_edit', $image, $attachment_id, $size); 388 436 if ( function_exists('imagealphablending') && function_exists('imagesavealpha') ) { 389 437 imagealphablending($image, false); … … 411 459 412 460 if ( $filepath && file_exists( $filepath ) ) { 413 461 if ( 'full' != $size && ( $data = image_get_intermediate_size( $attachment_id, $size ) ) ) { 462 463 /** 464 * Filter the path to the current image. 465 * 466 * @since 3.1.0 467 * 468 * @param string $path Path to the current image. 469 * @param string $attachment_id Attachment ID. 470 * @param string $size Size of the image. 471 */ 414 472 $filepath = apply_filters( 'load_image_to_edit_filesystempath', path_join( dirname( $filepath ), $data['file'] ), $attachment_id, $size ); 415 473 } 416 474 } elseif ( function_exists( 'fopen' ) && function_exists( 'ini_get' ) && true == ini_get( 'allow_url_fopen' ) ) { 475 476 /** 477 * Filter the image URL if not in the local filesystem. 478 * 479 * @since 3.1.0 480 * 481 * @param string $image_url Current image url. 482 * @param string $attachment_id Attachment ID. 483 * @param string $size Size of the image. 484 */ 417 485 $filepath = apply_filters( 'load_image_to_edit_attachmenturl', wp_get_attachment_url( $attachment_id ), $attachment_id, $size ); 418 486 } 419 487 488 /** 489 * Filter the returned path or URL of the current image. 490 * 491 * @since 2.9.0 492 * 493 * @param string|bool $filepath File path or URL to current image or false. 494 * @param string $attachment_id Attachment ID. 495 * @param string $size Size of the image. 496 */ 420 497 return apply_filters( 'load_image_to_edit_path', $filepath, $attachment_id, $size ); 421 498 } 422 499