[Snippet] Auto Image Embed

Little Mods and Snips 1

[Snippet] Auto Image Embed

Postby Sekuro » 30 Dec 2011, 17:22

Auto Image Embed

Show images in posts by just posting an image link

Image

Instruction

open

posting.php

find

Code: Select all
            if (!sizeof($error))
            {

after add

Code: Select all
        // Auto Image Embed / 4seven / 2011
        $matches = array();
        preg_match_all("#http://(.*?)\.(?:jpe?g|png|gif)#i" , $preview_message , $matches);
        foreach ($matches[0] as $img_matches){
        if(!empty($img_matches)){
        $preview_message = preg_replace('#<a class="postlink(.*?)" href="' . $img_matches . '"(.*?)</a>#i',
                                        '<img src="' . $img_matches . '" alt="" />',
                                        $preview_message);
                                        }}
        // Auto Image Embed / 4seven / 2011         

open

viewtopic.php

find

Code: Select all
         // Parse the message and subject
        $message = censor_text($row['post_text']);

after add

Code: Select all
             // Auto Image Embed / 4seven / 2011
            $matches = array();
            preg_match_all("#http://(.*?)\.(?:jpe?g|png|gif)#i" , $message , $matches);
            foreach ($matches[0] as $img_matches){
            if(!empty($img_matches)){
            $message = preg_replace('#<a class="postlink(.*?)" href="' . $img_matches . '"(.*?)</a>#i',
                                    '<img src="' . $img_matches . '" alt="" />',
                                    $message);
                                    }}
            // Auto Image Embed / 4seven / 2011     
Mod-Bot / Service-Team
User avatar
Sekuro

Tiptop

Tiptop
 
Posts: 241
Joined: 11 Feb 2008, 11:49
 
Resolution: 1440x900


Return to Snip Cl@ss I

Who is online

Users browsing this forum: No registered users and 2 guests

cron