Image Widget - Version 3.1.6

Version Description

Fixed Wordpress 3.0 bugs. (Thanks kenvunz)

Download this release

Release Info

Developer peterchester
Plugin Icon 128x128 Image Widget
Version 3.1.6
Comparing to
See all releases

Code changes from version 3.1.5 to 3.1.6

Files changed (2) hide show
  1. image-widget.php +12 -2
  2. readme.txt +6 -2
image-widget.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Image Widget
4
  Plugin URI: http://wordpress.org/extend/plugins/image-widget/
5
  Description: Simple image widget that uses native Wordpress upload thickbox to add image widgets to your site.
6
  Author: Shane and Peter, Inc.
7
- Version: 3.1.5
8
  Author URI: http://www.shaneandpeter.com
9
  */
10
 
@@ -37,6 +37,7 @@ class SP_Image_Widget extends WP_Widget {
37
 
38
  global $pagenow;
39
  if (WP_ADMIN) {
 
40
  if ( 'widgets.php' == $pagenow ) {
41
  wp_enqueue_style( 'thickbox' );
42
  wp_enqueue_script( $control_ops['id_base'], WP_PLUGIN_URL.'/image-widget/image-widget.js',array('thickbox'), false, true );
@@ -50,6 +51,12 @@ class SP_Image_Widget extends WP_Widget {
50
 
51
  }
52
 
 
 
 
 
 
 
53
  function loadPluginTextDomain() {
54
  load_plugin_textdomain( $this->pluginDomain, false, trailingslashit(basename(dirname(__FILE__))) . 'lang/');
55
  }
@@ -73,7 +80,10 @@ class SP_Image_Widget extends WP_Widget {
73
  if ($width && $height) {
74
  $uploads = wp_upload_dir();
75
  $imgpath = $uploads['basedir'].'/'.$attachment['file'];
76
- if ($image = image_resize( $imgpath, $width, $height )) {
 
 
 
77
  $image = path_join( dirname($attachment_url), basename($image) );
78
  } else {
79
  $image = $attachment_url;
4
  Plugin URI: http://wordpress.org/extend/plugins/image-widget/
5
  Description: Simple image widget that uses native Wordpress upload thickbox to add image widgets to your site.
6
  Author: Shane and Peter, Inc.
7
+ Version: 3.1.6
8
  Author URI: http://www.shaneandpeter.com
9
  */
10
 
37
 
38
  global $pagenow;
39
  if (WP_ADMIN) {
40
+ add_action( 'admin_init', array( $this, 'fix_async_upload_image' ) );
41
  if ( 'widgets.php' == $pagenow ) {
42
  wp_enqueue_style( 'thickbox' );
43
  wp_enqueue_script( $control_ops['id_base'], WP_PLUGIN_URL.'/image-widget/image-widget.js',array('thickbox'), false, true );
51
 
52
  }
53
 
54
+ function fix_async_upload_image() {
55
+ if(isset($_REQUEST['attachment_id'])) {
56
+ $GLOBALS['post'] = get_post($_REQUEST['attachment_id']);
57
+ }
58
+ }
59
+
60
  function loadPluginTextDomain() {
61
  load_plugin_textdomain( $this->pluginDomain, false, trailingslashit(basename(dirname(__FILE__))) . 'lang/');
62
  }
80
  if ($width && $height) {
81
  $uploads = wp_upload_dir();
82
  $imgpath = $uploads['basedir'].'/'.$attachment['file'];
83
+ error_log($imgpath);
84
+ $image = image_resize( $imgpath, $width, $height );
85
+ if ( $image && !is_wp_error( $image ) ) {
86
+ error_log( is_wp_error($image) );
87
  $image = path_join( dirname($attachment_url), basename($image) );
88
  } else {
89
  $image = $attachment_url;
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: Shane & Peter, Inc.
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4BSPTNFFY6AL6
4
  Tags: widget, image, ad, banner, simple, upload, sidebar, admin, thickbox, resize
5
  Requires at least: 2.8
6
- Tested up to: 2.9.1.1
7
- Stable tag: 3.1.5
8
 
9
  == Description ==
10
 
@@ -44,6 +44,10 @@ Please visit the forum for questions or comments: http://wordpress.org/tags/imag
44
 
45
  == Changelog ==
46
 
 
 
 
 
47
  = 3.1.5 =
48
 
49
  Fixed PHP 5 bug. Removed 'public' declaration. http://wordpress.org/support/topic/362167 Thanks mpwalsh8, jleuze, PoLaR5, NancyA and phoney36
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4BSPTNFFY6AL6
4
  Tags: widget, image, ad, banner, simple, upload, sidebar, admin, thickbox, resize
5
  Requires at least: 2.8
6
+ Tested up to: 3.0
7
+ Stable tag: 3.1.6
8
 
9
  == Description ==
10
 
44
 
45
  == Changelog ==
46
 
47
+ = 3.1.6 =
48
+
49
+ Fixed Wordpress 3.0 bugs. (Thanks kenvunz)
50
+
51
  = 3.1.5 =
52
 
53
  Fixed PHP 5 bug. Removed 'public' declaration. http://wordpress.org/support/topic/362167 Thanks mpwalsh8, jleuze, PoLaR5, NancyA and phoney36