Plugin Directory

Changeset 594277


Ignore:
Timestamp:
09/04/2012 04:07:14 AM (14 years ago)
Author:
splashingpixels.com
Message:

added check for hosting server allow_url_fopen, curl fallback

Location:
sp-wpec-variation-image-swap/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sp-wpec-variation-image-swap/trunk/includes/class-core.php

    r551487 r594277  
    8383       
    8484        // get the image size info
    85         $image_size = @getimagesize( $image_src );
    86         $image_width = $image_size[0];
    87         $image_height = $image_size[1];
     85        // checks to make sure PHP config allows url fopen
     86        if ( ini_get( 'allow_url_fopen' ) )
     87        {
     88            $image_size = @getimagesize( $image_src );
     89            $image_width = $image_size[0];
     90            $image_height = $image_size[1];
     91        }
     92        else
     93        {
     94            $ch = curl_init();
     95            curl_setopt ( $ch, CURLOPT_URL, $image_src );
     96            curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
     97           
     98            $contents = curl_exec( $ch );
     99            curl_close( $ch );
     100           
     101            $new_image = ImageCreateFromString( $contents );
     102            imagejpeg( $new_image, 'temp.jpg', 100 );
     103           
     104            $imageinfo = @getimagesize( 'temp.jpg' );
     105            $image_width = $image_size[0];
     106            $image_height = $image_size[1];                 
     107        }
     108       
    88109       
    89110        // get the attachment from the attachment id
  • sp-wpec-variation-image-swap/trunk/readme.txt

    r563773 r594277  
    55Requires at least: 3.0
    66Tested up to: 3.4
    7 Stable tag: 2.0.3
     7Stable tag: 2.0.4
    88
    99Plugin that adds product variation image swapping function to Wordpress e-Commerce plugin (WPEC). Requires 3.8+ of WPEC plugin.
     
    4545== Changelog ==
    4646
     47= 2.0.4 =
     48* Update - added a check to see if hosting server allows url fopen, if not, use curl.
     49
    4750= 2.0.3 =
    4851* Update - changed a selector name in the swap script to prevent compatibility issues with other plugins
Note: See TracChangeset for help on using the changeset viewer.