ckeditor uploading images - ckeditor

So I have my ckeditor working nicely together with the uploader of the fckeditor.
But only on localhost.
When uploaded to my server, the file manager uploads the Photo to the designated folder, but doesn't seem to get the url back for implementing it in the editor. I then always get the error of "image source url is missing".
Can anyone tell me what I am missing here ?
How come it works on localhost and doesn't on the server ?
I do think I changed all the appropriate paths.
Cheers
Chris

I found the solution of this error in CKEditor when you upload image file. This problem is due CKEDITOR open dialog in a frame so ; for solving this error check the "X-FRAME-OPTION" in you htaccess and set the value to SAMEORIGIN instead of DENY. If it's not in your htaccess it's when you send http header in your app.
For PHP before send content just set header like this :
header('X-FRAME-OPTION : SAMEORIGIN');
For more information about X-FRAME-OPTION check this link https://developer.mozilla.org/en-US/docs/Web/HTTP/X-Frame-Options.
Best regards

in my case (in .htaccess) it was obligatory to unset the header value first which was added by (I suppose) server:
<ifModule mod_headers.c>
Header unset X-Frame-Options
Header set X-Frame-Options SAMEORIGIN
</ifModule>

Related

Setting the Access-Control-Allow-Origin CORS for wordpress site

I had some problems to set a correct cors header for using external resource in my wordpress installation. I have a subdomain which exposed by another domian name.
I've got following error by using some plugin which load resources from my website by using an ajax call:
XMLHttpRequest cannot load [resource-URL] No 'Access-Control-Allow-Origin' header
I created a .htaccess file in the root directory of my subdomain.The file content is:
Header set Access-Control-Allow-Origin "sub.site.com"
I read in many blogs that you should use
Header set Access-Control-Allow-Origin "*"
but i guess that is a bad idea.

Images not shown on IE11

I'm using Symfony2 and the liip/imagine-bundle however the images are not displayed on IE11 and just shows a X placeholder, other browsers are fine. Has anyone encountered this?
UPDATE
It seems that IE11 fails to get the content-type of a the image source. Basically I'm using an image source without the extension Ex. <img src="/myimage" /> this is fine with other browsers however for IE11 it doesn't seem to recognise the file type.
So what I did was to remove the no-sniff directive
<IfModule mod_headers.c>
#Header set X-Content-Type-Options: nosniff
</IfModule>
It seems that IE11 fails to get the correct content type of the image when no-sniff is turned on.

icons not showing up in firefox without "www." before domain

I'm using OpenCart for my site. The icons fail to appear when you visit example.com but they do appear if you visit www.example.com.
Any ideas what is going on here?
I have just edited config.php file and removed www. and it works for naked domain but the icons do not load
// HTTP
define('HTTP_SERVER', 'http://example.com');
define('HTTP_CATALOG', 'http://example.com');
define('HTTP_IMAGE', 'http://example.com/image');
define('HTTP_ADMIN', 'http://example.com/admin');
I would redirect all non www traffic to www. This should take care of your issue with icons. It'll also prevent possible SEO issues as a result of duplicate content/pages.
If you have an apache server add a redirect to your .htaccess.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
What worked for me:
Go into the config.php file (please backup your file first) in the main directory of your OpenCart installation.
Under //HTTP (lines 5-8 for me), edit
lines:
define('HTTP_SERVER', 'http://example.com/shop/');
define('HTTP_CATALOG', 'http://example.com/shop/');
define('HTTP_IMAGE', 'http://example.com/shop/image/');
define('HTTP_ADMIN', 'http://example.com/shop/admin/');
to read:
define('HTTP_SERVER', '/shop/');
define('HTTP_CATALOG', '/shop/');
define('HTTP_IMAGE', '/shop/image/');
define('HTTP_ADMIN', '/shop/admin/');
.
Depending on your installation, I'm sure this could cause some problem somewhere I just haven't found it... yet... (maybe someone else could correct me -- I really don't mind; I like to learn).
This worked for me:
Add to .htaccess file this line: Header add Access-Control-Allow-Origin "your-domain.com"
Change "your-domain.com" required by the url.
If in our configuration file use: define ('HTTP_SERVER' 'http://example.com/);
Then place: Header add Access-Control-Allow-Origin "http://www.example.com/"
I tested this in opencart 2.0.

Not receiving X_REQUESTED_WITH request header in Apache localhost

I just set up Apache 2.4 32-bit on my Windows 7 desktop and I am testing a simple AJAX website. I have an .htaccess file that directs all non-resource-file requests to index.php, and within this .php script I check $_SERVER["HTTP_X_REQUESTED_WITH"] to determine if a given request is ajax or not (I set this header myself when I send the ajax request).
Though the header is getting set, Apache seems to be dropping it before my .php script runs. I can see the request header in Chrome, but it's not there in the .php script. I even tried logging \"%{X_REQUESTED_WITH}i\" in Apache's access.log, but I don't see it there either.
This functionality works when the site is running on Bluehost. Do I need to configure Apache to get it to work on my local machine?
Apache 2.4 now drops all headers with underscores, for 'security' reasons.
According to their docs, you can add them by adding this to your htaccess:
SetEnvIfNoCase ^Accept.Encoding$ ^(.*)$ fix_accept_encoding=$1
RequestHeader set Accept-Encoding %{fix_accept_encoding}e env=fix_accept_encoding
Where Accept.Encoding and Accept-Encoding is the header name. Underscores are replaced with dots and hyphens respectively.

Cache browser images if no file extension provided

When a browser requests a jpg and the server returns the data but not as a reference to a jpg file but rather sends the jpg data itself, is it possible for the browser to cache the data?
For example:
http://www.somewebsite.com/image/abc
This uri returns jpg data. Is there some way to get the browser to cache the data it receives to avoid having to request it again?
I just attempted to debug your example but received an Account Suspended. Webmaster, please, contact support. page!
So as I am working blind can I suggest researching the header('Expires: SOME DATA HERE') function in PHP (I assume you are using PHP).
If the solution does not lie there you can also use .htaccess to set the headers using
<IfModule mod_expires.c>
ExpiresActive On
############################################
## Add default Expires header
## http://developer.yahoo.com/performance/rules.html#expires
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
ExpiresDefault "access plus 1 year"
</FilesMatch>
</IfModule>
This example taken from http://www.robertwent.com/blog/servers-and-hosting/45-set-expires-headers-in-htaccess
Ultimately it is the headers that tell the browser how you advise the content is cached. What the browsers actually does can sometimes be surprising.

Resources