freefcw / hustoj

the online judge system for acm/icpc
http://www.hustoj.org
263 stars 64 forks source link

better admin problem and news editor #10

Closed dotkrnl closed 10 years ago

dotkrnl commented 10 years ago
dotkrnl commented 10 years ago

BTW, TinyMCE is LGPL 所以直接用是没有问题的 XD

freefcw commented 10 years ago

有关上传文件的功能没?

dotkrnl commented 10 years ago

There's no uploading function in TinyMCE. But there's plugins for that. TinyMCE 没有上传功能。但是有相应插件(我没有加)。

I'm trying to find a plugin for image with base64 encoding. XD 我正在试图找一个用 base64 实现图片功能的插件 XD,不过还没找到。

dotkrnl commented 10 years ago

I've adapted a plugin to insert image (< 100KB && 800x800 max) with base64 encoding. It only supports modern browser.

我改写了一个插件,可以插入小于 100KB,最大 800x800 像素的图片的 base64 编码。 呃当然只支持现代浏览器 XD。

freefcw commented 10 years ago

为什么要用base64编码呢?这样有点太重了吧

dotkrnl commented 10 years ago

The data URI scheme is a URI scheme (Uniform Resource Identifier scheme) that provides a way to include data in-line in web pages as if they were external resources. It is a form of file literal or here document. This technique allows normally separate elements such as images and style sheets to be fetched in a single HTTP request rather than multiple HTTP requests, which can be more efficient. http://en.wikipedia.org/wiki/Data_URI_scheme

And with base64, we can insert small image without uploading it.

根据维基百科的介绍,对于较小的图片,这个方法更为高效。 而且这个方法,可以不用增加上传图片的功能 XD 直接嵌入 HTML

dotkrnl commented 10 years ago

Large images will be truncated which cause problem. 那啥,我们讨论一下要不要增大数据库里字符串允许的长度? 我突然发现比较大的图片会被截断。

dotkrnl commented 10 years ago

In database of Google Code version, only images smaller than 50 KB can be saved. 我刚刚测试了一下,Google Code 版本的数据库只能放大概 50 KB 的图片一张。

dotkrnl commented 10 years ago

I've removed the plugin from this pull request. 我已经把这个插件暂时从 PR 里去除了。 等我们决定怎么处理再新开一个 PR。 然后所以这个,如果你觉得没问题就可以 merge 了。

freefcw commented 10 years ago

图片还是单独存放的啦,比如uploads文件夹,我先解决一下验证码的问题,讨厌的广告

dotkrnl commented 10 years ago

conflict resolved 冲突已解决