Wednesday 16 July 2014

Image not displaying uploaded by CKeditor

Uploaded Image Not uploading/Not showing can have might reasons:
  1. Upload image path is not correct.
  2. Tmp folder have not write permission to upload image. Because when have submit form after selecting image, It first move to tmp folder then to target folder.
  3. Image folder would not have enough permission.
  4. Image Path is not correct while getting image, also make sure image has been uploaded in target folder.
  5. Image is not accessible.



Uploaded Image not showing in Email
Problem: Whenever we upload any image through FCK editor. It start displaying in editor as well as in pages of our website.
Sometimes when we display all the content including image in our site it works fine. But when we send all the contents to email then all work except uploaded image (image was not displaying in email).
Reason behind this can that image have relative path.
Solution: Now for this, there should be absolute path in image source including www.example.com. So, that it work in our site as well as in emails.

for this just do the follow lines when uploading image through FCK-Editor.
1) open app/webroot/js/editor/filemanager/connectors/php/config.php
2) replace
Code:
$Config['UserFilesPath'] = '/app/webroot/files/'; 

$Config['UserFilesAbsolutePath']=''; 



WITH

Code:

$Config['UserFilesPath'] = "http://".$_SERVER['HTTP_HOST']."/app/webroot/files/"; 

$Config['UserFilesAbsolutePath'] = $_SERVER['DOCUMENT_ROOT']."/app/webroot/files/";



3) Clear the cache from

Code:

/app/tmp/cache/ 

/app/tmp/cache/persistent 

/app/tmp/cache/views

Above example are for cakephp, If you are using other framework/CMS then only path can be little different but reason will be same. Just understand the above all points of uploading image issue. then you will be able to overcome any type of issue regarding uploading through any Framework OR CMS.



Suggestion for SEO:
With use of text editor, we can upload multiple images/videos and set the attributes like alt tag, title tag in the photos/videos. These tags play very vital rote in SEO. If your photos videos have ALT tag, Title Tag then your website would have better ranking in Search Engines.


5 Best Related Posts are Following:1. PHP Technical Interview Questions and Answers for Fresher and Experienced
2. How to Add attribute in A Tag using jQuery
3. Wordpress Website title repeated two times in browser header [SOLVED]
4. How can I prevent SQL-injection in PHP [SOLVED]
5. Htaccess RewriteRule Flags by Code Example