Follow Me on Twitter!

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

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to StumbleUpon

Subscribe me feed! If you enjoyed this article, get latest updates via RSS feed or by email.

30 Responses to “WP Plugin: Simple Image Linking v1.0”

  1. Sy41ful
    July 1st, 2005 | 4:02 am | Reply

    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.....c&t=77

  2. CypherHackz
    July 1st, 2005 | 9:22 pm | Reply

    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. Sam Salisbury
    July 27th, 2005 | 8:42 am | Reply

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

  4. Administrator
    July 27th, 2005 | 5:04 pm | Reply

    Thank you! :d

  5. matt
    August 4th, 2005 | 3:32 am | Reply

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

  6. Administrator
    August 4th, 2005 | 2:31 pm | Reply

    check out the php file. its all there.

  7. vamsi
    August 14th, 2005 | 5:23 am | Reply

    Explanation not included in the download package.

    Can you please check?

  8. imageszap.com
    December 20th, 2005 | 5:16 am | Reply
  9. alphademon
    January 19th, 2006 | 7:45 pm | Reply

    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.

  10. hijacker
    January 31st, 2006 | 6:06 am | Reply

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

  11. Administrator
    January 31st, 2006 | 9:09 am | Reply

    I will check the problem.

  12. Trevor
    February 1st, 2006 | 4:45 am | Reply

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

  13. Choco
    July 17th, 2006 | 12:36 am | Reply

    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.

  14. mykad
    September 4th, 2006 | 3:52 pm | Reply

    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);

    ?>

  15. mykad
    September 4th, 2006 | 3:53 pm | Reply

    Sorry, here is the code again:


    ";

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

    return $content;
    }

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

    ?>

  16. mykad
    September 4th, 2006 | 3:55 pm | Reply

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

  17. CypherHackz
    September 4th, 2006 | 5:48 pm | Reply

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

  18. mykad
    September 5th, 2006 | 1:49 am | Reply

    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);

    ?>

  19. mykad
    September 5th, 2006 | 1:55 am | Reply

    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.

  20. mykad
    September 5th, 2006 | 1:58 am | Reply

    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);

    ?>

  21. mykad
    September 5th, 2006 | 1:59 am | Reply

    ok I give up

  22. CypherHackz
    September 5th, 2006 | 1:43 pm | Reply

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

  23. claire
    November 20th, 2006 | 7:08 am | Reply

    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.

  24. CypherHackz
    November 20th, 2006 | 10:20 am | Reply

    it is in the .php file. :)

  25. Olivier
    January 24th, 2007 | 5:14 pm | Reply

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

    Olivier :-?

  26. canon sx110
    September 5th, 2008 | 12:00 am | Reply

    i’ll check it
    thanks a lot

Leave a Reply