Skip to content

Instantly share code, notes, and snippets.

@roytanck
Created October 29, 2013 08:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roytanck/7210690 to your computer and use it in GitHub Desktop.
Save roytanck/7210690 to your computer and use it in GitHub Desktop.
Simple test plugin to trigger the WordPress issue described in Trac ticket #17626 (http://core.trac.wordpress.org/ticket/17626). The image ID is hardcoded, so you'll have to edit the plugin so it matches your upload.
<?php
/*
Plugin Name: WCEU test plugin
Plugin URI: http://core.trac.wordpress.org/ticket/17626
Description: Test plugin to trigger bug #17626
Version: 1.0
Author: Roy Tanck
Author URI: http://www.this-play.nl
Licence: GPL
*/
if( !function_exists('wceu_test_init') ){
function wceu_test_init(){
add_image_size( 'wceu1', 300, 300, true );
add_image_size( 'wceu2', 300, 200, true );
add_image_size( 'wceu3', 300, 100, true );
}
add_action( 'init', 'wceu_test_init', 10, 1 );
}
if( !function_exists('wceu_test_function') ){
function wceu_test_function(){
$img = image_get_intermediate_size( 6, array( 300, 300 ) );
var_dump( $img );
$img2 = image_get_intermediate_size( 6, array( 300, 299 ) );
var_dump( $img2 );
$img3 = image_get_intermediate_size( 6, array( 300, 301 ) );
var_dump( $img3 );
return '<p><img src="wp-content/uploads/2013/10/' . $img['file'] . '" alt="testimg" /></p>';
}
add_shortcode( 'wceutest', 'wceu_test_function' );
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment