tips:image_nolink
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tips:image_nolink [2008-12-10 01:01] – changed line number 89.246.167.21 | tips:image_nolink [2012-11-24 11:15] (current) – deprecated with new media manager flam | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Change default behavior of inserted images so they don't link ====== | ||
- | |||
- | For a few sites I created, the users don't ever remember to use the ?nolink syntax when adding images. Without "? | ||
- | |||
- | |||
- | |||
- | ===== Method 1 ===== | ||
- | |||
- | To make it the default when using the Media Selection page that inserted images have the ?nolink automatically appended, we can redefine the mediaSelect javascript function. It'll take an argument to determine if the media file type is an image, and if so, it'll add the "? | ||
- | |||
- | in '' | ||
- | <code javascript> | ||
- | * Edited to accomodate a default where no images are linked | ||
- | */ | ||
- | function mediaSelect(file, | ||
- | if (image == ' | ||
- | opener.insertTags(' | ||
- | } else { | ||
- | opener.insertTags(' | ||
- | } | ||
- | window.close(); | ||
- | } | ||
- | </ | ||
- | |||
- | Then we just change where mediaSelect is called to reflect this. in '' | ||
- | <code php> | ||
- | |||
- | // added to remove image links by default | ||
- | if($item[' | ||
- | // remove link from images | ||
- | ptln('< | ||
- | | ||
- | '</ | ||
- | } else { | ||
- | | ||
- | | ||
- | '</ | ||
- | } | ||
- | |||
- | (...) | ||
- | |||
- | //edited to remove image links by default | ||
- | print '<a href=" | ||
- | </ | ||
- | |||
- | --[[ian@subcultured.org|ian]] | ||
- | |||
- | |||
- | |||
- | ===== Method 2 ===== | ||
- | |||
- | If you already have an established site and wish to turn off image linking by default, make the following change:\\ | ||
- | Open **inc/ | ||
- | <code php> | ||
- | //get linking command | ||
- | if(preg_match('/ | ||
- | $linking = ' | ||
- | }else if(preg_match('/ | ||
- | $linking = ' | ||
- | }else if(preg_match('/ | ||
- | $linking = ' | ||
- | }else{ | ||
- | $linking = ' | ||
- | } | ||
- | </ | ||
- | This would make a good option to add into the core.\\ | ||
- | --- // | ||
- | |||
- | >IIRC, this will actually make **all** inserted media default to nolink, which may not be desirable (think PDF links, for example) | ||
tips/image_nolink.1228867265.txt.gz · Last modified: 2009-09-21 03:26 (external edit)