• Hello, I love how videos are automatically embedded when I input the video URL.

    I would like some help doing the same thing with image URLs with an extension of JPG, JPEG, PNG, GIJ, and TIFF.

    I have searched the plugin library and I have not yet found a solution.

    I attempted to create an add_filter function with str_replace and regex but I was not able to code it properly.

    Could someone help me with what I need done?

    http://wordpress.org/extend/themes/p2/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter davidhinojosa

    (@davidhinojosa)

    Here is the code I used.

    //function content_magic($content) { 
    
    //
    //$content = get_the_content();
    //
    //$m= preg_match_all('!http://[a-z0-9\-\.\/]+\.(?:jpe?g|png|gif)!Ui' , $content , $matches);
    //
    //
    //if ($m) {
    //    $links=$matches[0];
    //    for ($j=0;$j<$m;$j++) {
    //        $content=str_replace($links[$j],'<img src="'.$links[$j].'">',$content);
    //     }
    //}
    //
    //
    //
    //        return $content;
    //    }

    This worked on another theme, but then my Video URLs would not automatically be turned into videos.

    Hi David,
    WordPress does allow image URL embeds from Flickr, Photobucket, and SmugMug. See the full list here: http://codex.wordpress.org/Embeds.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Theme: P2] Automatic Image Embed’ is closed to new replies.