Month: Tháng Tám 2014

Rename Image Uploaded With CKFinder

Posted on

When uploading files, you can automatically remove spaces, characters with accents, and such. Set “ForceAscii” to “true” in the config.php file:

$config['ForceAscii'] = true;

The code for the “ForceAscii” setting is found starting on line 59 in this file:
ckfinder\core\connector\php\php5\CommandHandler\FileUpload.php

    if ($_config->forceAscii()) {
      $sFileName = CKFinder_Connector_Utils_FileSystem::convertToAscii($sFileName);
    }

To rename the file as it’s uploaded, you could add your own code to the “ForceAscii” code.

To add some Static text to the beginning or the end:

    if ($_config->forceAscii()) {
        $sFileName = CKFinder_Connector_Utils_FileSystem::convertToAscii($sFileName);
        $sFileName .= "YourTextHere"; // Append your text
        $sFileName = "YourTextHere" . $sFileName; // Prepend your text
    }

ust before the force ascii code is a string replace, you could add your own version of a string replace if that would meet your goals.

$sFileName = str_replace(array(":", "*", "?", "|", "/"), "_", $sUnsafeFileName);

If the text used for the rename will vary, you’ll need to provide a lot more details:
Will the text vary depending on which user is uploading the file?
Will it vary for each image, regardless of who uploads it?
What will determine the actual text that is used (based on username?).

The latest version, 2.1 allows the user to upload multiple files at one time. This could affect the approach you take.

If you provide additional information, I’ll see if I can come up with a better answer.


Is this meant to allow the end user to rename their images? It is possible for the user to rename an image as follows:

When they are looking at the images in the file browser window, they would right click on an image. “Rename” is one of the options in the context menu.

EDIT: The latest version of CKFinder (2.1) has a config setting that is placed in the config.js file:

config.showContextMenuArrow = true;

this setting allows the user to access the context menu by clicking on an arrow that appears in the corner of the image.

 
 
 

SQLdumpSplitter Phần mềm chia nhỏ file dữ liệu SQL

Posted on Updated on

Có lẽ việc import dữ liệu vào CSDL mysql quen thuộc với các webmaster, đặc biệt sử dụng phpmyadmin để thực hiện.

Khi upload file database để restore lại website khá lớn sẽ mất nhiều thời gian, nhất là khi tốc độ mạng chậm. Thậm chí việc import sẽ không thành công do đó việc chia nhỏ ra thành nhiều phần để import từng phần là cần thiết.

Tải SQLdumpSplitter tại đây

Đọc file SHS trên wondows 7, 8

Posted on Updated on

Thỉnh thoảng nhận được file scrap do các chị em gửi mà mình dùng windows 8 không đọc được. Nguyên nhân là do trên windows XP khi copy lẽ ra là phải copy cái tệp tin .doc thì chị em lại copy nội dung trong văn bản dán trực tiếp vào USB hay desktop rồi gửi đi nên nó cho nên nó xuất hiện dạng file tạm của word (scrap) .SHS. Mà trên windows7, 8 hầu như không đọc được, muốn đọc được thì phải sử dụng thủ thuật cũng khá phức tạp. Nay mình có phần mềm convert từ file SHS này sang file word để mở bằng word dễ dàng.

Tải phần mềm convert SHS to DOC tại  đây