Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+9 votes
5.3k views
in Plugins by
retagged by

Just now I realized that CKEditor uploads files into the database (table qa_blobs).

As far as I could see those images are not cached and thus result in slower server handling.

This is why I would like to ask how to change that behavior to have the files saved to a folder on the server, e.g. \uploads\images\

From my understanding, I have somehow to change the "qa-wysiwyg-upload.php" from line 102??

 

Searching the net regarding CKEditor (which is definitely pain) I found a little discussion about image uploads and absolute paths, if that helps: Image uploading in FCKeditor as well as kind of tutorial here.

 

Added:
I get a bit confused reading about folder vs. database in stackoverflow. Post by John Gietzen:

"FileStream solves most of the problems around storing the files in the DB:

  1. The Blobs are actually stored as files in a folder.
  2. The Blobs can be accessed using either a database connection or over the filesystem."

Others disagree...

 

What is Question2Answer using? What is the best way to serve cached images?

Q2A version: 1.5
by
You should take a look at TinyMCE. IMO it's a more solid editor to start with, and uploading files to a folder is dead simple with a plugin.

1 Answer

+4 votes
by

The caching of images in the end user's browser is unrelated to the way in which the images are stored on the server. When outputting a blob (including an image), Q2A adds an HTTP header to encourage caching at the client end (see qa-blob.php).

Having said that, if you want blobs to be stored as server files rather than in the database, you can write a plugin which overrides the following functions:

qa_db_blob_create(...)

qa_db_blob_read(...)

qa_db_blob_delete(...)

qa_db_blob_exists(...)

qa_get_blob_url(...)

I'm sure other people would enjoy this plugin too!

by
Thanks for your answer. If caching is encouraged, then I don't worry. So the only extra work for the server is the db connection as far as I understand.

When talking about images in folders, I hat Apache's module mod_expires.c in mind, to set an expiration date and force caching.
by
Would anybody be interested to write that plugin ?

- Storing images in filesystem
- Storing a thumbnail in filesystem

Pricing ?
by
I am but not now ;) Storing in files is better only because caching. I think in new Q&A version it will be included
by
The issue of caching is independent of how the files are stored. Q2A sets the appropriate HTTP headers on images to allow them to be cached by proxies and browsers.
by
You are right. Just most of scripts caching blobs bad. Your Q&A not, is ok. Thanks
by
Want to comment that my interest in this is not caching but easier image handling and bandwidth. If I have thousand images in folders, i can resize them easily, if they are stored in the database I dont know an easy way to modify them. The other thing is, that on image based projects the images could be moved easily to a content delivery network.
by
@monk333: How is your experience, have you used the new feature of uploading to a folder instead to the db? ... Image Handling: Yes, it is easier to access it directly and resize it. Good point! And right, the images could be easily transferred to another storage. Thanks for pointing out these two essential advantages.
...