Monday, March 9, 2015

How to give Subdomain path in Jbimages plugin in tinymce

recently i got some website project that use subdomain for it's image or something like CDN for serving images, and i got some serious problem when i try to upload an image using tinymce plugin called Jbimages.

the problem is image not showing in the editor because it's relative url like '../cdn_public_html/uploads/filename.jpg', I solve this problem by editing this 2 files

tinymce/plugins/jbimages/ci/application/controllers/uploader.php
tinymce/plugins/jbimages/config.php


by adding some configuration ($conf['base_image_url']) and setting that to the controller (function upload), so the output (ajax) is prepended with your sub domain or your CDN url.
see my Gist below for how to do this

1 comment: