Convert http to https on save
i did a module with a custom text format filter :

function my_module_filter_info() {  
   $filters ['to_https_compatible_converter'] = array (
        'title' =&gt; t ( 'HTTPS compatible convertible filter' ),
        'description' =&gt; t ( 'convert http:// to // for https  compatiblity' ),
        'process callback' =&gt; '_module_filter_process',
        'tips callback' =&gt; '_module_filter_tips' 
   );   
  return $filters;
 }




 function _module_filter_tips($filter, $format, $long = FALSE) {
switch ($filter-&gt;name) {        
    case 'to_https_compatible_converter' :
        return t ( 'convert http:// to // for https  compatiblity' );   
}
    }

  function _module_filter_process($text, $filter) { 
      switch ($filter-&gt;name) {      
    case 'to_https_compatible_converter' :

        $dom = new DOMDocument ();
        @$dom-&gt;loadHTML ( utf8_decode ( $text ) );

        $images = $dom-&gt;getElementsByTagName ( 'img' );
        foreach ( $images as $image ) {
            $image_src = $image-&gt;getAttribute ( 'src' );
            $image_src=str_replace(['http://','https://'],'//',$image_src);             
            $image-&gt;setAttribute ( 'src' ,$image_src);

        }

        $links = $dom-&gt;getElementsByTagName ( 'a' );
        foreach ( $links as $link ) {
            $href = $link-&gt;getAttribute ( 'href' );
            $href=str_replace(['http://','https://'],'//',$href);       
            $link-&gt;setAttribute ( 'href' ,$href);

        }

        $iframes = $dom-&gt;getElementsByTagName ( 'iframe' );
        foreach ( $iframes as $iframe ) {
            $src = $iframe-&gt;getAttribute ( 'src' );
            $src=str_replace(['http://','https://'],'//',$src);         
            $iframe-&gt;setAttribute ( 'src' ,$src);           
        }

        return $dom-&gt;saveHTML ();

}
 }