Before-After Photo Effect Plugin
March 4th, 2010
Before After Plugin: Can be used to display difference in before and after photos.
Detailed Description:
Before After plugin integrates jQuery Before/After Plugin in WordPress. It can be used to show the difference between edited and original photo, before and after photos of changes, etc. Please check ‘Other Notes’ for the Usage instructions to see how to use it on your blog.
Features:
- Can be used on multiple photos on the same page/post
- The options for Jaavascript can be customized for your blog/taste thourgh Before after options page
- Even the effects for single instance of before after effect can be customized (see FAQs for more details)
Demosites:
- On this site you can find various posts where before after effect is being used like this one -> Trying Photoshop Filters
- On my testing site ->Operation with Default wp theme
Limitations:
-
Presently this plugin can only show before after effect on single post/page-> V0.1.5 -
This plugin will show the effect only for 1 set of photos on single post/page-> V0.1.5 -
Might need a reloading home/index/archive/category pages to show effect on all images-> V1.0.0 -
Issues with Chrome, Safari web browsers-> V1.0.0 (enable Automatic Dimension detect option)
Requirements: WordPress version 2.9+ tested upto 3.2
Auto Installation: (Recommended)
- Go to your blog’s WordPress Admin Panel -> Options -> Before After
- Search for “before after instruite”
- Click “Install now”
Manual Installation: (If for some reason you can not use above Auto installation method)
- Download: Before-After WordPress Plugin
- Plugin folder in the WordPress plugins folder must be `before-after`
- Upload folder `before-after` to the `/wp-content/plugins/` directory
- Activate the plugin through the ‘Plugins’ menu in WordPress
- Check out ‘Usage Instructions’ for using it on your blog.
Configuration:
- Go to your blog’s WordPress Admin Panel -> Plugins -> Add New
- Set the parameters as per your requirements (should work with default parameters too)
- See Other Notes -> Configuration for more details on configuration parameters
Upgrade Notice:
- V1.0.0:If you can not see the effects after the automatic upgrade, try deactivating and then reactivating the plugin
Usage Instructions
- Write the content of your post other than the images
- Switch to ‘HTML-editor’ mode of the post editor area
- Click ‘BeforeAfter’ button (This will start the ‘beforeafter’ shortcode)
- Add the photos to your post through the wordpress image/media uploader
- Atleast 1 photo should be left align when you insert the images on your post
- The ‘left-aligned’ photo is taken as before photo so please align your photos accordingly
- After you have inserted the two images in the post Click ‘BeforeAfter’ button again to close ‘/beforeafter’ shortcode.
- You can add more content to your post after closing the ‘/beforeafter’ shortcode
- The content other than image information withing the ‘beforeafter]…[/beforeafter’ is ignored when the shortcode is executed, in other places like home page archive page the content will be shown as is in the post.
Configuration Options
Plugin Customization:
- Use Custom Styling
Enable this to use custom styling (css) and provide the custom css in below Custom Styling Code text area. If you want to integrate the style information in your css file leave the below text area blank.
CSS tags used by the plugin
.ba-container {margin-left:auto; margin-right:auto;}
.ba-container + div.balinks {margin: 0 auto;}
.ba-container div img {max-width: none;}
- Javascripts
Select one of the following- wordpress: (recommended option) Use javascripts bundled with wordpress
- plugin: Uses javascripts from plugin folder jquery(1.6.1) jquery-ui.custom(1.8.13)
- custom:provide your own scripts (provide complete information including the script tags in Custom JS Code text area.
- Auto Detect Dimensions
Enable this if you are having issues on your site with Chrome or Safari Web Browsers
Javascript Customization:
- Introduction Animation (animateintro)
When enabled the drag bar will start on extreme right side and gradually move to the positions specified by introPosition
- Introduction Delay (introDelay)
The time in milliseconds to wait before starting the introduction animation when enabled animateintro is enabled
- Introduction Duration (introDuration)
The time in milliseconds, it will take drag bar to go from right side to the positions specified by introPosition during the introduction animation when enabled animateintro is enabled
- Introduction Position (introPosition)
The initial position where the drag bar will be located, value between 0.0 (extreme left) and 1.0 (extreme right)
- Show Full Links (showFullLinks)
whether or not to display links below the image that a visitor can click on that will automatically show the full before or full after image
- Before link Text (beforeLinkText)
Text of link to display for showing full Before image
- After link Text (afterLinkText)
Text of link to display for showing full After image
- Path to images (imagePath)
Full path to images used by plugin
- Cursor (cursor)
Type of cursor to show on drag bar
- Click Speed (clickSpeed)
Speed specified in milliseconds for click animation
- Link Display Speed (linkDisplaySpeed)
Speed specified in milliseconds for animation when before or after image link is clicked
- Divider Color (dividerColor)
Hex Color code for the divider bar
- Image Width (imgWidth)
This value is used in case the plugin code cannot find image width when auto detect dimensions is enabled
- Image Height (imgHeight)
This value is used in case the plugin code cannot find image width when auto detect dimensions is enabled
Javascript Customization for each instance of before after photo effect:
You can supply custom options with each beforeafter short code. Use shorthand description provided with options above to specify custom parameters. For example below code
beforeafter dividerColor="#ff0000" beforeLinkText="Before"
Changelog
- V1.0.0 (Released: July 8, 2011)
- Total revamped of code
- Using modified version of Jquery Before After original script to V1.3
- Added options page
- Before After Javascripts options can be provided through shortcode attributes now
- V0.1.5
- Fixed the bug causing php error
- V0.1.4
- Changed code to use JScripts bundeled with WordPress
- Modified the beforeafter.js for a fix for depreceated function
- bug in image cause image height to default to 0 px
- V0.1.3
- Upgrade the original jquery.beforeafter to V1.2
- V0.1.2
- Fixed a bug causing the button to put shortcode not showing up in editor
- V0.1.1
- Fixed a bug caused by themes (like twentyten) which set max-width for images
- V0.1.0
- Changed to show effect on pages other than single post
- Added activation and deactivation functions to add/delete options in wp-table
Posted under: Plugins, Wordpress
Tagged with: after, before, before-after, jquery, open source, photo effects, plugins, software, Wordpress





This plugin doesn’t seem to work for me. Can only view the before image. I thought it might be from the Thesis theme, but I get the same thing when I use TwentyTen too.
Are there any tricks I should know? (other than left aligning the first/before image)
Thanks,
Fred
Spotted an odd one today, when I grabbed the handle the whole page scrolls up. The reveal works but with the whole page moved.
Same thing happens in Chrome and in Safari
Example: http://www.richardolpin.co.uk/digital-makeover/
None of the demos on your own website is working. Images are displayed beneath another or next to another. I tested in IE, chrome and firefox.
i am getting this error
Warning: strpos() [function.strpos]: Offset not contained in string in /home/content/79/7325279/html/wp-content/plugins/before-after/before-after.php on line 339
Warning: strpos() [function.strpos]: Offset not contained in string in /home/content/79/7325279/html/wp-content/plugins/before-after/before-after.php on line 339
here is my code
[beforeafter]
http://rudyshoushany.com/wp-content/uploads/2011/12/bef.jpg
http://rudyshoushany.com/wp-content/uploads/2011/12/aft.jpg
[/beforeafter]
Can you point me to the page where you are getting this error?
and the above error will occur if plugin can not find image html tag or left align tag for images in the post
In your code you seem to be adding link to images directly which will not work you have to put them in image tags.
I am trying to use the BeforeAfter plugin to display/demonstrate changes in the human brain with advanced Alzheimer’s Disease. My images are stacked – aligned to the left – even though the Before image is AlignLeft in the code while the After image is AlignNone.
I obviously don’t get the split line onscreen or any functionality. Any help would be appreciated.
it seems both the before and the after picture are shown in the feed, could this be changed somehow?
i.e. with a preference to only show after maybe?
This plugin does not control the content of the post in any way, it just modifies when the pictures are display on screen on web page.
Regarding controlling how your posts appear in feed have a look at feed customizing plugins.
I just read the instructions and see I need to left-align one image. unfortunately, I really need to have them centered, is there a workaround to still be able to use your plugin?
You can use css to keep the image center aligned on your post.
but how does that fit in with the instructions:
still having problems. inserted one left-aligned picture and one centered, all seems skew. inserted both left aligned and I can see only one, switching between before and after, shifts one picture but still cannot see the other one
here is a preview link, both images are left-aligned: http://pacura.ru/?p=278&preview=true&preview_id=278&public=1&nonce=a8e3f79f41
sorry, would you mind having a look please? I really would love to get this working
Sorry its says you don’t have permissions to view the page
no idea what went wrong there so I went ahead and published the post although it looks totally broken, please have a look here: http://pacura.ru/blog/manastirea-voronet/
could you check again please? http://pacura.ru/blog/manastirea-voronet/
Your page seems to be loading multiple versions of jquery-ui script
this one
ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js
and this one
ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js
jquery ui script should be loaded only once and that before this plugin script
Thanks
I think I managed to remove the plugin that caused that script to load multiple times but I can’t change the order they are loaded, even if I knew how I would have to edit a couple of plugins that use jquery. can’t you tell your plugin to load last? would you mind having another look?
If all the plugins are using default jquery script provided by WordPress, the loading sequence of individual plugins should not matter.
I will see if Loading sequence can be changed for this plugin and will let you know when I find a solution
I`ve used your code for my blog posting .. but my images are just alignement in a row..
Before image on top and just below the After image…
where can be the failure ???
here is my blog link…
http://blog.pshots-photography.com/?p=13286&preview=true
Nobody a solution on this ?!
The page you mentioned in your link shows 404 Not Found Error.
Looking at the source of your not found page your page seem to be loading jquery twice once in head
ajax/libs/jquery/1/jquery.min.js?ver=3.2.1
and then in footer
ajax/libs/jquery/1.4.4/jquery.min.js
which might be creatong problem.
Thanks
For some reason, the slider isn’t working. Clicking the “show only before” and “show only after” links works like a charm, but manually moving the slider doesn’t work at all. You can see the post I’m referring to on my homepage (URL is above). Thanks….!
On your homepage your theme modularity is loading the jquery UI again and that too an old version, which might be creating the issue.
Can you disable loading of jquery-ui-1.7.2.custom.min.js use only ui.core.js?ver=1.8.12 which is loaded by WordPress and see if it solves your issue?
Thanks
Not sure how to go about doing that? Any suggestions?
Seems like you have found a way for the UI script issue.
There seems to be some image alignment problems
for that I will recommend you to Enable custom css in Before after Plugin options and then add below to in custom css text box
.ba-container {margin-left:auto; margin-right:auto;}.ba-container + div.balinks {margin: 0 auto;}
.ba-container div img {margin:0 !important; padding:0 !important; max-width: none;}
I didn’t notice any image alignment issues, but I went ahead and applied the custom css code you suggested. What exactly did you see that seem to be aligned improperly? Thanks!
Change this line
.ba-container div img {margin:0 !important; padding:0 !important; max-width: none;}to
.ba-container div img {max-width: none;}and when on the post page see the top of divider line extends above the photos.
Thanks for a great plugin.
Nevertheless, there’s a problem.
My slider handle-image looks like this (see link) – has kind of a frame…
Here’s the link: http://i.imgur.com/0oiTf.jpg
Any suggestions?
Thanks a lot.
Kurt,
It might be some css issue, can you point me to the page where that problem is appearing?
Also try deactivating and then reactivating the plugin once.
Thanks
Hello Kurt,
I had a look at your page, below is the solution for your issue
Enabled Custom css on your Before after options page and add below css into Custom css text box
.ba-container {margin-left:auto; margin-right:auto;}
.ba-container + div.balinks {margin: 0 auto;}
.ba-container img {max-width: none; background:none; border:none; padding:0;}
.ba-container div img {max-width: none; background:none; border:none; padding:0;}
The last line might not be required, so you can try once without it also.
Also note this will also remove the border and padding from your before after images itself.
Let me know how it turns out.
Thanks
Wow – thanks a lot.
Working great now. Wouldn’t have been able to find that out myself.
Thanks again for your great plugin. Planning to use it on a photoblog-site.
Kurt
Glad it worked out for you.
Do share your website where you use the plugin.
Thanks
Hi
Can I modify Yor plugin (somewhere) to have before/after effect like here http://www.jpegmini.com/main/home
(don’t need to click on image – also like in “mouseover”)
Sorry its not possible with the present JS code
Hi there. A great plug-in and I’ve used it before on a static html page, but now i’m trying to use it in my test WordPress site. Here’s the page I’m testing: http://mattscreative.com/test/mc/?p=535
I’ve tried just about every suggestion on this board (adding the custom js, adding the custom css, checking auto detect, deactivating/activating, etc), but am still unable to make it work. I’m sure it’s a simple fix. Any suggestions?
Thanks.
Matt,
Its not working on your site because of jquery-1.4.2.min.js file which your theme is loading after wp_header function. if you look at the source of your page you have 2 jquery files loaded
Recommended solutions
Use the jquery provided by WordPress just remove the version being loaded by your theme
Thanks
Thanks for your response. I removed the instance of jquery-1.4.2.min.js from my header.php and it works, but now my fancybox effect no longer works to display my images on another part of my site. Apparently the fancybox is dependent on the jquery-1.4.2.min.js. Is there anyway I can get both to work? I know it’s an off-topic question, but any advice you have would be great.
Thank you.
The main issue was that your site was loading the jquery again after the beforeafter script and there are other plugins which are loading jquerry before my plugin.
I will recommend to search on WordPress forum how to use a different version (other than which is supplied with default WordPress) of jquery plugin
and I have not tested latest version of beforeafter plugin with jquery 1.4 so can’t say if it will work with it.
Thanks
Finally got it to work, while keeping the integrity of my other theme plugins. What I did was, from the Before-After Settings page, I chose Custom JS (and left it blank). I then created a custom page (i.e. mycustompage.php) and added/linked the scripts of jquery(1.6.1) & jquery-ui.custom(1.8.13) at the top of the page. Might not be protocol scripting, but it works and hopefully it helps someone with a similar situation. Thanks again for the cool plugin.
[...] After * Set the parameters as per your requirements (should work with default parameters too) * See Plugin Pagefor more details on configuration [...]
I just wanted to come back and thank you for all the hard work you have done on this AWESOME plug-in! I see most of the comments on this thread are about plug-in issues or user error, both of which I have experienced. Your diligence has paid off because now it works like a charm! I even got two sliders on the same post! I hope you don’t mind, but here is a link for everyone to see this in action: http://iranwatsonphoto.com/digital-magic-the-virtues-of-hiring-a-professional-retoucher/
Thanks again and keep up the good work!
Nice work.
I also appreciate users sharing how and for what they are using my plugin.
Cheers!
Hi, this plug-in is perfect for what I need….except it’s not working. : ( I’ve followed the instructions to the book, but the picture still shows up on my page with the line in the middle…which doesn’t animate or drag anywhere…it’s just stuck. Any ideas on a fix?
Thanks
can you point me to the page where you are having the issue?
Hello
I installed newest version on wordpress 3.2.1.
Settings are default and in post editor I have not beforeafter button to add chortcode.
Hi,
I just checked I am using WP3.2.1 on this site and I can see shortcode button without any issue.
Can you post the screenshot of your editor
and just to inform you short code button only appears in HTML view
Thanks
Hi
Here is screenshot http://mateuszmalinowski.pl/beforeafter-test.png
I use CKEditor.
Sorry the present shortcode button is displayed only in HTML mode of editor. It won’t come up in WYSIWYG editors.
You can manually add shortcodes in your post as mentioned in usage instructions, I will have a look at ckeditor or other WYSIWYG editors and see if we can add buttons to those editor but that will be in some future release.
Thanks
Hi
I turned off CKEditor, I can see beforeafter button, but it doesn’t work on my site – (preview). Code:
[beforeafter][/beforeafter]
Should I edit my header.php or something else?
Is possible to use Your plugin to mouseover effect?
http://refotografie.blogspot.com/2011/07/piotrkowska-219-221-dom-jozefa-johna.html
(http://bavotasan.com/2009/creating-a-jquery-mouseover-fade-effect/ http://introblogger.blogspot.com/2010/07/image-mouseover-fadegreyscale-effect.html)
Can you point me to the page where you are trying to use before after effect and its not working?
Also try deactivating and then reactivating the plugin once.
Regarding the mouse over effect its not possible with present code and settings might be possible by customizing the code will have a look at it and let you know if I find any easy solution
Thanks
I send message via contact site.
HI I just tested your code
It works fine
you can see it here http://playground.instruite.com/2011/08/17/testing-mateusz-code/
I checked your website you sent me and looking at the code the problem seems to be the jquery 1.4.2 being reloaded by gpress plugin itself.
Recommended Solution
Disable gpress and see if before after works, then see how you can customize gpress to use default jquery provided by WordPress
Hi
thank You. Now it works. I did not disable qpress. Only in “qpress option” ->”advanced settings” select “NO” in “Add jQuery to Theme”.
I would be very grateful if You find easy solution for mouseover effect. I try it before (before edit “qpress option” -> …) without success. Maybe now will be ok.
Hi! I use your cool Before After plugin.I need such plugin that can help make next and previous links (like galllery). Can you help me? – http://piccy.info/view3/1807189/c13f346c7d683282e3a0a862400fe0aa/IMGhttp://i.piccy.info/i5/89/71/1807189/Snymok_240.jpg
Do you mean Previous/Next Pictures in same post or Previous/next posts itself?
Previous/Next Pictures in same post
I have finally updated to version 1.0.1 and now i have problems with the effekt/plugin :-/
http://www.thomas-reimann.com/2011/07/85mm-f1-8-im-studio/
Here you can see that the images aren’t alligned correct and the “handle” isn’t displayed correctly… i have no clue what’s the problem.
I will recommend you to once deactivate and then reactivate the plugin
For your pictures being miss aligned problem
Enabled Custom css on your Before after options page and add below css into Custom css text box
.ba-container {margin-left:auto; margin-right:auto;}.ba-container + div.balinks {margin: 0 auto;}
.ba-container div img {margin:0 !important max-width: none;}
have added margin:0 !important which should take care of your images being missaligned
For handle images check whats in “Path to images” option on your before after page, it should show url of yoursite/path to wordpress plugin/before-after/images
if its different adjusts its value
Thanks
Thank you for that fast response… everything worked out fine, except the aligned problem, the images are still not aligned correctly.
i have added the custom css.
The problem ist only the vertical alignment… any additional idea?
Hi
sorry missed a semicolon after the important
.ba-container {margin-left:auto; margin-right:auto;}
.ba-container + div.balinks {margin: 0 auto;}
.ba-container div img {margin:0 !important; max-width: none;}
Works perfect! Thank you!!!
Getting an odd error here. Rather than revealing the ‘after’ image, the handle is scrolling the image to one side of the container.
Example: http://www.richardolpin.co.uk/workflow-examples/mono-conversions/
This is in Safari 5.1 on OSX 10.7 (Lion)
There are a couple of warnings appearing on the page load:
“Warning: strpos() [function.strpos]: Offset not contained in string in /homepages/43/d97354903/htdocs/www.richardolpin.co.uk/wp/wp-content/plugins/before-after/before-after.php on line 363
Warning: strpos() [function.strpos]: Offset not contained in string in /homepages/43/d97354903/htdocs/www.richardolpin.co.uk/wp/wp-content/plugins/before-after/before-after.php on line 371″
Any ideas?
HI Richard,
You have to make sure that the before image is left aligned, and after image is right aligned.
I saw the code on your page and image seems to be having alignednone property
Thanks
Excellent, sorted it now thanks!
Hi, I found a bug (I think), when I try to change “Introduction Position” this message apper:
“Intro Position values needs to be between 0.0 and 1.0. Submitted Value 0.7 ”
When I type: “0,7″ only show before picture.
Thanks for letting me know, will have a look at it and release an upgrade in couple of days.
Have pushed an update 1.0.1 to WordPress database. should fix the above issue.
Thanks
The plugin works well on my site, but it is conflicting with my theme. Likely a jQuery conflict. Changing the script options does not resolve it. When the plugin is active it kills a thumbnail slider and a slideshow on my homepage. Any ideas on how to fix this conflict?
You seem to be using jquery uislider version 1.7.2
while the core jquery ui version used by wordpress is 1.8.12 which my plugin is using.
Does your slider function works when before after plugin is deactivated?
If yes then in before after options page Choose “Custom” in javascripts and add the information regarding below script incustom js code box
jquery.beforeafter-1.3.instruite.min.js?ver=3.2.1
Note You need to add complete path and js info including script tag
best way will be to copy it from source code of your homepage when the plugin is active
Also I noticed that the handle images on your before after pages are missing
In before after options page make sure the “Path to images” is having the correct value
I have this plugin installed on my website, and it works very well, but i’ve found it behaviors strange on Chrome. ;( It’s hard to pick the slider, and many times it select one of the images making it totally blue.
Testing on FF it works flawless. ;( This problem appears only in chrome…
I have the same problems with Chrome.
Have pushed the update 0.1.4, it should hopefully fix the chrome problem.
Please test and let me know.
great plugin I definitely gonna try this one on my site.
feel free to visit me guys at
Photography Hobby
Hey! I’m so glad the plugin works at my blog…!
But I have a nother question.
Is there any way that i can influence where the line appears?
by default it appears exactly in the middle of the two images.
my idea is, that i can choose a number between 1-100 within the beforeafter tag which defines where the line appears dynamically from tag to tag… that would be awesome…
but i think that’s not that easy, maybe it’s a suggestion for the next update!?
If this isn’t possible dynamically, is there a way to change the default position in general?
Hi,
Can not say about dynamic positioning but am planning to provide option for static in next update (basically when I have option page made up for the plugin).
Thanks
It sometimes work on the site. It has nothing to do with the browser. Perhaps it’s a problem with the internet linkt to the include files.
Anyway – I have the problem on my site http://alansoerensen.dk/?p=156
If saw before in http://www.permanentmakeupenhancements.com/before-after-photos/ , the problem is when you enter directly to the post, if click on “Before/after plugin til WordPress” in right menu works fine.
Maybe there is some piece of code that isn’t loading.
I just checked with Firefox 4 on both the sites for 4-5 times (clearing the browser cache and stuff) and it is working. I don’t have chrome right now but will check later with it and let you guys know what kind of bug it is.
Thanks
You’re right, works fine on FF4, IE9, IE8 but not on Chrome.
Are you sure? I have Mac OsX and the effect doesn’t work in my home page when I enter in the site. I test with the ipad it’s the same thing.
The code look like this (Can be there have an error?) :
How are you adding images to your post?
The code which you added in your comment doesn’t has any img html tags?
Also when I went to your site initially it showed only Links but on refresh it showed images properly (checked with firefox).
are you using any cache plugins?