• Resolved Zane Matthew

    (@zanematthew)


    I’m creating a custom upload form for my site that allows users to upload images. My code base for uploading media files is on github.

    You can view a demo of the working version on youtube, note that in the demo version the code is used inside of a theme.

    Once I use the same code base inside my plugin this line fails to make the thumbnail images. Note the image is being uploaded and the postmeta table is being updated just fine.

    Again, only problem is the post thumbnails are not being created.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Zane Matthew

    (@zanematthew)

    I solved it creating my own resizeImage method which, is sort of a wrapper for image_resize.

    Usage:

    $media = new MediaUpload;
    $uploaded_media = $media->saveUpload( $field_name='Filedata' );
    $thumb  = $media->resizeImage( $uploaded_media['file'], 'thumb' );
    $square = $media->resizeImage( $uploaded_media['file'], 'square' );
    $main   = $media->resizeImage( $uploaded_media['file'], 'main' );

    Thread Starter Zane Matthew

    (@zanematthew)

    Fixed

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Cant create post thumbnails from a plugin’ is closed to new replies.