The use of Baidu Ueditor editor found that upload a larger picture will be distorted, just started to think that PHP has done a picture compression, and then carefully looked at some configuration parameters, found that the editor with an automatic compression of the picture function, and the compression of the picture Distorted!
Decided to remove this compression function, if you have to compress, then to the service side of PHP to deal with it!
Find configuration file: Ueditor/php/config.json
Set the imagecompressenable to False!
thinkphp using Baidu editor ueditor upload picture path before and after the two more '/22% ' problem!
I use Baidu Editor, upload pictures when the picture in the editor can be displayed! As shown in figure
But after inserting the database, it escapes the path of the picture
As the next, to the database on the change to the city like this!
<p></p>
Copy Code
Copy Code
At the time of the page output, the image address becomes like this.
http://www.wtsqc.com/%22/qingchun/uploads/20131230/52c05e50560c0.gif/%22/
Picture address before and after a%22 how to do? How to solve?
Solution
When you submit a form to insert data in thinkphp, the single and double quotes are automatically escaped, and the backslash is automatically added.
But I don't want to add a backslash to single quotes and double quotes,
When you submit a form to insert data in thinkphp, the single and double quotes are automatically escaped, and the backslash is automatically added.
But I don't want to add a backslash to single quotes and double quotes,
such as: HDs "gh" J ' G ' H
will be automatically escaped as: Hds\ "gh\" j\ ' g\ ' H
Note that what is needed is to cancel this escaped function, instead of using the stripslashes () function to remove the backslash, which does not require an official this automatic escape function.
So search the web for solutions:
1, in the thinkphp directory, open the Thinkphp\lib\driver\db directory in turn, and in dbmysql.class.php this file to modify the function of the escapestring function to:
/**
* SQL instruction Security filtering
* Access Public
* @param string $str SQL string
* Return string
*/
Public Function escapestring ($STR) {
Modify Zhou double quote double escape
if (!GET_MAGIC_QUOTES_GPC ()) {
if ($this->_linkid) {
Return mysql_real_escape_string ($STR, $this->_linkid);
}else{
Return mysql_escape_string ($STR);
}
} else {
return $str;
}
}
Original function:
/**
* SQL instruction Security filtering
* Access Public
* @param string $str SQL string
* Return string
*/
Public Function escapestring ($STR) {
Modify Zhou double quote double escape
if ($this->_linkid) {
Return mysql_real_escape_string ($STR, $this->_linkid);
}else{
Return mysql_escape_string ($STR);
}
}
2, add in public file:
//Prevent double escape
/*if (GET_MAGIC_QUOTES_GPC ()) {
function stripslashes_deep ($value) {
$value = is _array ($value)?
Array_map (' Stripslashes_deep ', $value):
Stripslashes ($value);
return $value;
}
$_post = Array_map (' Stripslashes_deep ', $_post);
$_get = Array_map (' Stripslashes_deep ', $_get);
$_cookie = Array_map (' Stripslashes_deep ', $_cookie);
}*/
Note: If the server is escaped, then after Thinkphp escaped again, it will create a double escape bug in the program
after modification, my website program backstage entry is no problem. It seems that when you encounter the use of thinkphp, note that if the server opened the filter single or double quotes, it may conflict with the thinkphp. So add a layer of judgment, it can be a good solution to the problem.