WP Plugin: Simple Image Linking v1.0

Yet another plugin from me. This plugin used for easy images/photos linking where you don’t need to write long line to link an image. But you have to create a folder for the images. I have included the explanation in the download package. 😉

Plugin Name: Simple Image Linking
Plugin URI: http://www.cypherhackz.net/?p=32
Description: A simple image linking. Easy to modified. You can change the thumbnails width and height. You also can change the images folder too.
Version: 1.0
Author: Fauzi Mohd Darus
Author URI: http://www.cypherhackz.net

Download Link: cypher_simple-imagelinking.zip

Comments

  1. wokeh… plugin ni cukup menarik jugak… kiranya kalau ada posing image.. cam wallpaper dorang leh klik terus display size sebanar lah kan.. erm.. best yang ni.. tapi aku pun stil tak leh lagi nak guna plugin ni kat blog aku..sebab aku tak tau cam ner nak gabungkan dengan drop image shadow sebagaimana yang dibincangkan disini: http://www.weblogscenter.com/m.....&t=77

  2. He3. Thanks sebab test plugin aku nih. Tu la, aku pun tengah nak install plugin drop shadow tu. Tapi masih takde mase lagi. Tengok ah, bile2 free nanti. 🙂

  3. Good work, simple like you say but does the job without making my crappy old server have to work too hard 🙂

  4. Thank you! :d

  5. great script. is there a way to maintain ratio aspect? vertical pics get distorted.

  6. check out the php file. its all there.

  7. Explanation not included in the download package.

    Can you please check?

  8. alphademon says:

    hi there,
    very great plugin but why cant i do more than 1 pictures ? whenever i do [slink img=image.jpg] twice or more ; only one picture appears. why is this ?

    example :

    [slink img=1.jpg] [slink img=2.jpg] [slink img=3.jpg]

    So only the 1st one will show up

    your help is appreciated.

  9. i have this problem too. anyone a good idea to fix this shortly?

  10. I will check the problem.

  11. How do I add more than one picture to a particular post.

  12. hai,

    I really want a screenshot before I ever attempt ANY plugin. Could you please add a few screenshots, or even better give a couple of example sites. Great development work by the way.

  13. This code will do substitutions for all images:

    “;

    $content = str_replace($replace, $pic_link, $content);
    } // for

    return $content;
    }

    add_filter(‘the_content’, ‘cypher_simplelink’, 10);

    ?>

  14. Sorry, here is the code again:


    ";

    $content = str_replace($replace, $pic_link, $content);
    } // for

    return $content;
    }

    add_filter('the_content', 'cypher_simplelink', 10);

    ?>

  15. I tried – if someone can tell me how to submit code I’ll submit it.

  16. that is because wordpress will convert < and > as html code. to solve this issue, replace < with & lt; (without space) and > with & gt; (without space). 😉

  17. I after I got the multiple images to work I found I wanted to control each individual image. So you can control border, height, width, vspace, hspace, and align for each photo.


    <?php

    HOW TO USE:
    Just use this tag in your post

    [slink img=image-name.jpg height=100 border=2 vspace=5 hspace=5 align=left]

    */

    function cypher_simplelink($content) {

    global $post;

    $pic_folder = 'wp-content/uploads/admin'; //images folder

    $n = preg_match_all("/\[slink.*\]/i", $content, $matches);

    for($j=0;$j<$n;$j++) {
    $pic_width = "";
    $pic_height = "";
    $pic_align = "";
    $pic_vspace = "";
    $pic_hspace = "";
    $pic_border = "";

    $replace = $matches[0][$j];

    if(preg_match("/\simg=(\S*?)[\]\s]/i", $replace, $picmatch)) {
    $pic_file = $picmatch[1];

    if (preg_match("/\swidth=(\S*?)[\]\s]/i", $replace, $picwidth)){
    $pic_width = $picwidth[1];
    }

    if (preg_match("/\sheight=(\S*?)[\]\s]/i", $replace, $picheight)){
    $pic_height = $picheight[1];
    }

    if (preg_match("/\salign=(\S*?)[\]\s]/i", $replace, $picalign)){
    $pic_align = $picalign[1];
    }

    if (preg_match("/\svspace=(\S*?)[\]\s]/i", $replace, $picvspace)){
    $pic_vspace = $picvspace[1];
    }

    if (preg_match("/\shspace=(\S*?)[\]\s]/i", $replace, $pichspace)){
    $pic_hspace = $pichspace[1];
    }

    if (preg_match("/\sborder=(\S*?)[\]\s]/i", $replace, $picborder)){
    $pic_border = $picborder[1];
    }

    }

    $pic_link = "<a href=\"" . get_settings('siteurl') . "/" . $pic_folder . "/" . $pic_file .
    "\" target=\"_blank\"><img src=\"" . get_settings('siteurl') . "/" .
    $pic_folder . "/" . $pic_file .
    "\" $pic_width .
    "\" height=\"" . $pic_height .
    "\" align=\"". $pic_align .
    "\" vspace=\"". $pic_vspace .
    "\" hspace=\"". $pic_hspace .
    "\" border=\"" . $pic_border . "\"/></a>";

    $content = str_replace($replace, $pic_link, $content);
    } // for

    return $content;
    }

    add_filter('the_content', 'cypher_simplelink', 10);

    ?>

  18. The code above is missing a begin comment before the HOW TO USE:

    Should be

    /*
    HOW TO USE

    That’s just in case someone was going to cut and paste this code.

    Thanks for the great plugin idea it has helped me tremendously. The upload feature and copy to content in wordpress is unreliable in firefox and isn’t useful. Your plug in makes everything easier and stress free.

  19. I’m sorry I seem to be cluttering up the comments section. I thought I sent the code in a previous comment, but now I don’t see it. Here is the correct code (no need to add /*).

    <?php
    /*

    HOW TO USE:
    Just use this tag in your post

    [slink img=image-name.jpg height=100 border=2 vspace=5 hspace=5 align=left]

    */

    function cypher_simplelink($content) {

    global $post;

    $pic_folder = ‘wp-content/uploads/admin’; //images folder

    $n = preg_match_all(“/\[slink.*\]/i”, $content, $matches);

    for($j=0;$j<$n;$j++) {
    $pic_width = “”;
    $pic_height = “”;
    $pic_align = “”;
    $pic_vspace = “”;
    $pic_hspace = “”;
    $pic_border = “”;

    $replace = $matches[0][$j];

    if(preg_match(“/\simg=(\S*?)[\]\s]/i”, $replace, $picmatch)) {
    $pic_file = $picmatch[1];

    if (preg_match(“/\swidth=(\S*?)[\]\s]/i”, $replace, $picwidth)){
    $pic_width = $picwidth[1];
    }

    if (preg_match(“/\sheight=(\S*?)[\]\s]/i”, $replace, $picheight)){
    $pic_height = $picheight[1];
    }

    if (preg_match(“/\salign=(\S*?)[\]\s]/i”, $replace, $picalign)){
    $pic_align = $picalign[1];
    }

    if (preg_match(“/\svspace=(\S*?)[\]\s]/i”, $replace, $picvspace)){
    $pic_vspace = $picvspace[1];
    }

    if (preg_match(“/\shspace=(\S*?)[\]\s]/i”, $replace, $pichspace)){
    $pic_hspace = $pichspace[1];
    }

    if (preg_match(“/\sborder=(\S*?)[\]\s]/i”, $replace, $picborder)){
    $pic_border = $picborder[1];
    }

    }

    $pic_link = “<a href=\”” . get_settings(‘siteurl’) . “/” . $pic_folder . “/” . $pic_file .
    “\” target=\”_blank\”><img src=\”” . get_settings(‘siteurl’) . “/” .
    $pic_folder . “/” . $pic_file .
    “\” $pic_width .
    “\” height=\”” . $pic_height .
    “\” align=\””. $pic_align .
    “\” vspace=\””. $pic_vspace .
    “\” hspace=\””. $pic_hspace .
    “\” border=\”” . $pic_border . “\”/></a>”;

    $content = str_replace($replace, $pic_link, $content);
    } // for

    return $content;
    }

    add_filter(‘the_content’, ‘cypher_simplelink’, 10);

    ?>

  20. ok I give up

  21. sorry dude… your comments trapped by my akismet plugin. i have un-spammed all of your comments. :d

  22. Hi, I downloaded the image linking file, but there enclosed was only one .php file, and no read me instructions (I did not find any clues after activating the program, under options, files, etc….) I know you mention a requisite image folder not included with the zip. folder. can you supply more info. or a link to more info? thanks, i am new at wordpress.

  23. it is in the .php file. 🙂

  24. Hi,
    are you going to make this plugin compatible with WP 2.1 ?

    Olivier 😕

  25. i’ll check it
    thanks a lot