Support » Plugins » Custom-sized Thumbnail

  • Hello,

    Could someone enlighten me.

    How can you create a custom-sized image attachment thumbnail that not depends on the Thumbnail Settings in Settings > Media?

    Specifically, I’d like to output a 100×75 zoom-cropped thumbnail that can’t be changed from within the wp-admin Settings page.

    I tried image_resize() but it outputs a PHP Fatal Error where it says that wp_load_image() is an undefined function.

    Thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Arr!

    1. Checked that both functions exists (in wp-includes/media.php and wp-admin/includes/image.php)
    2. Manually include wp-admin/includes/image.php before image_resize() is called in my function (because I thought it’s an “admin only” inclusion)
    3. Error: Functions in wp-admin/includes/image.php is defined twice (wp-admin/includes/image.php is included twice – and I can’t use include_once() because the second inclusion is after my function is called)
    4. Recreate image_resize() and wp_load_image() functionality in my function
    5. Problem solved, inefficiently

    I created my function in wp-content/themes/_themename_/functions.php. Don’t know if I will not have this problem or not, if I create my function as a plugin (don’t want to create a plugin because this is a theme-specific function).

    I think WordPress should include wp-admin/includes/image.php before including the theme’s functions.php, no?



    Grmph. Yes, problem exists for plugins. I am trying to write a plugin and encountered this error.

    This is still broken in trunk version 11794 as of 2009-08-09.



    Btw which is more efficient if we consider server process, bandwidth, bulky code, and possible native create_custom_thumbnail_size() function in the future?

    #1: To recreate the resizing functions.

    #2: Or to just use the smallest thumbnail size and change the dimension in HTML output? The “stretched/crippled” image will be hardly noticed if it’s small.


Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom-sized Thumbnail’ is closed to new replies.