It seems that HTTPS can not be read.
-
Loading image from custom field.
Please tell me how to load and display images from external servers such as BOX and salesforce.
It seems that HTTPS can not be read.
I do not have knowledge of the program….
-
Hi @kobamatsu,
What do you mean with “It seems that HTTPS can not be read”? Please share some more details (eg. steps to reproduce the issue) and I’ll look into it (feel free to include screenshots if you feel it’ll help to explain what’s going on).
sorry…
I can hardly speak English…[load and display images]
http://www.tosenad.com/id08454_ninihaikyaku4.JPG[not load and display images]
https://tosenad.box.com/shared/static/n52likkjabct02i8ruxx5p49x2dxl6rg.jpghttps://tosenad–c.ap0.content.force.com/servlet/servlet.FileDownload?file=00P1000000qYg73
Can not display secure server images?
I explain the issue as written in Japanese forum.
A custom field of post contains the image URL that begins as
https://
.
Plugin reads it, but accesses URL after replacinghttps
tohttp
.
The image cannot be loaded by HTTP because it lives in some cloud storage such as BOX.Thanks for chiming in, @gblsm! That clears things up a bit.
I’ll look into it as soon as I can, @kobamatsu. I’ll keep you guys posted.
To be more clear, the plugin accesses
http:/example.com/image.jpg
when the custom field hashttps:/example.com/image.jpg
.
I see the replacing (https => http) would be done in some cases (ex. is_ssl() is true), but I think the site admin may want to enable/disable it.Hey guys,
I just tested it out on my localhost and this is what I get:
The image loads just fine and preserves the HTTPS protocol.
I see the replacing (https => http) would be done in some cases (ex. is_ssl() is true), but I think the site admin may want to enable/disable it.
There’s is a replacement but it’s the other way around: if the website uses SSL and it tries to load an image from a none-secure URL (http), it’ll replace http with https:
/** * Render image tag. * * @since 3.0.0 * @access public * @param string src Image URL * @param array dimension Image's width and height * @param string class CSS class * @param object $post_object Post object (must contain, at least, the properties id and title) * @param string error Error, if the image could not be created * @return string */ public function render_image( $src, $size, $class, $post_object, $error = null ) { $img_tag = ''; if ( $error ) { $img_tag = '<!-- ' . $error . ' --> '; } $img_tag .= '<img src="' . ( is_ssl() ? str_ireplace( "http://", "https://", $src ) : $src ) . '" width="' . $size[0] . '" height="' . $size[1] . '" alt="' . ( ($post_object instanceof stdClass && isset($post_object->title) ? esc_attr( wp_strip_all_tags($post_object->title) ) : '' ) ) . '" class="' . $class . '" />'; return apply_filters( 'wpp_render_image', $img_tag ); } // render_image
Hi @hcabrera,
The cause was a conflict with an extra code which @kobamatsu added to his theme’s functions.php … He removed the code and the problem gone.Thanks for the update, guys 🙂 @kobamatsu @gblsm
- The topic ‘It seems that HTTPS can not be read.’ is closed to new replies.