[Plugin: WP-Cycle] Relative Path to Upload for SSL
-
Related to this question about transferring servers –
I’ve been having trouble with SSL-encrypted (https) pages. This is due to 2 reasons:
1) files for wp-cycle are served using static domains from WP
2) images are saved to database with full url, instead of base-relative url.The following DIFF/Patch seems to fix the issues. (copy code and save to .diff file).
Index: wp-cycle.php =================================================================== --- wp-cycle.php (revision 33973) +++ wp-cycle.php (revision 35541) @@ -110,12 +110,12 @@ // extract the $upload array extract($upload); - // the URL of the directory the file was loaded in - $upload_dir_url = str_replace(basename($file), '', $url); + ///Added blank upload message + if(isset($error)){ + echo '<div class="error" id="message"><p>Sorry, but there was a problem uploading your file: ', $error, ' Please try again.</p></div>'; + return; + } - // get the image dimensions - list($width, $height) = getimagesize($file); - // if the uploaded file is NOT an image if(strpos($type, 'image') === FALSE) { unlink($file); // delete the file @@ -123,6 +123,14 @@ return; } + // the URL of the directory the file was loaded in +///FIXME - correcting hardcoded image path for SSL + $upload_dir_url = wp_upload_dir(); //str_replace(basename($file), '', $url); + $upload_dir_url = str_replace( get_bloginfo('url'), '', $upload_dir_url['url'] ) . '/'; + + // get the image dimensions + list($width, $height) = getimagesize($file); + // if the image doesn't meet the minimum width/height requirements ... if($width < $wp_cycle_settings['img_width'] || $height < $wp_cycle_settings['img_height']) { unlink($file); // delete the image @@ -140,6 +148,9 @@ $file = $resized; $url = $resized_url; } + else { + $url = $upload_dir_url . basename($url); + } // make the thumbnail $thumb_height = round((100 * $wp_cycle_settings['img_height']) / $wp_cycle_settings['img_width']); @@ -444,7 +455,10 @@ add_action('wp_print_scripts', 'wp_cycle_scripts'); function wp_cycle_scripts() { if(!is_admin()) - wp_enqueue_script('cycle', WP_CONTENT_URL.'/plugins/wp-cycle/jquery.cycle.all.min.js', array('jquery'), '', true); +///FIXME - fixed path linking for HTTPS + wp_register_script('cycle', plugins_url('jquery.cycle.all.min.js', __FILE__), array('jquery'), '1.1', false); + wp_enqueue_script('cycle'); +# wp_enqueue_script('cycle', WP_CONTENT_URL.'/plugins/wp-cycle/jquery.cycle.all.min.js', array('jquery'), '', true); } add_action('wp_footer', 'wp_cycle_args', 15);
The topic ‘[Plugin: WP-Cycle] Relative Path to Upload for SSL’ is closed to new replies.