Donate Share January 2009: Project of the Month

TinyMCE

Tracker: Plugins

5 Complete php file/image manager (updated) - ID: 1698519
Last Update: Comment added ( tadejkan )

This is the updated file/image manager.

It should work in all major browsers, and with TinyMce 2.08 or higher
(perhaps even lower, haven't tested it).
Some basic info is included in readme.txt .. if there's something missing,
ask ;)

There's still one thing which would need to be fixed in this version
(calling out to anyone who would be able to fix it) - it doesn't handle
resizing vertically very well (horizontally should work).

For any other info, simply ask :)

Regards,
Tadej


TadejK ( tadejkan ) - 2007-04-11 14:46

5

Open

None

Nobody/Anonymous

None

None

Public


Comments ( 115 )

Date: 2008-06-05 19:34
Sender: tadejkan


The reason is primarily lack of time :(
A new version, which would include this and much much more, has been
planned for a long time .. but sadly, it's hasn't been realised yet.
I think that the GD library isn't too much to ask for from a host, so that
definitely isn't the problem .. ;)

Regards,
Tadej


Date: 2008-06-05 18:18
Sender: neonhorizon


Hi farvid,

Thats a nice solution, certainly produces neater HTML without the
Javascript.
I noticed you used the GDLib functions to get the image size, thats the
same library I used to do the resize on upload.

I wonder why Tadej didn't integrate your solution?
I know not everyone has GDLib maybe that is it?
Or maybe he just did not have time to do it yet?

Daniel




Date: 2008-06-05 18:04
Sender: faravid


I fixed resizing a long time ago and was e-mailed to TadejK, and this
solution doesn't use any css, just some simple calculations with PHP:

Replace contents of your image_browser_include.php with this code:

<table width="100%">
<?php
$count = 0;
for ($i=0;$i<sizeof($dirs);$i++) {
$count++;
if ($count == 1) echo "<tr>\n";
echo "<td align='center'><a class='dir' href='?type=" . $type . "&dir=" .
$requested_dir . $dirs[$i] . "'><img src='" . $folder_large_image . "'
width='" . $dir_width . "' border='0px'></a><br><a href='#'
onClick='confirm_delete_folder(\"" . $dirs[$i] . "\")'><img border=0 src='"
. $delete_image . "'></a> " . $dirs[$i] . "</td>\n";
if ($count == $pics_per_row || $i == (sizeof($dirs)-1)) {
$count = 0;
echo "</tr>\n";
}
}
$count = 0;
for ($i=0;$i<sizeof($files);$i++) {
$count++;
if ($count == 1) echo "<tr>\n";
list($width, $height) = getimagesize($dir . $files[$i]);

$file_width = (int)$file_width;
if ($height < $file_width && $width < $file_width) {
$width = "width='" . $width ."px'";
$height = "height='" . $height . "px'";
}

else {
if ($width > $height) {
$height = $height / ($width / $file_width);
$width = "width='" . $file_width ."px'";
$height = "height='" . $height . "px'";
}
else {
$width = $width / ($height / $file_width);
$width = "width='" . $width . "px'";
$height = "height='" . $file_width ."px'";
}
}

echo "<td align='center'><a class='file' href='#'
onClick='fileSelected(\"" . $requested_dir . $files[$i] . "\");'><img
src='" . $dir . "/" . $files[$i] . "' border='0px' " . $width . $height .
"></a><br><a href='#' onClick='confirm_delete(\"" . $files[$i] .
"\");'><img border=0 src='" . $delete_image . "'></a> " . $files[$i] .
"</td>\n";
if ($count == $pics_per_row || $i == (sizeof($files)-1)) {
$count = 0;
echo "</tr>\n";}

}
?>
</table>


Date: 2008-06-05 13:00
Sender: neonhorizon


Hi Tadej,
How did you get on with the changes to show vertically and horizontally
resized thumbnails?

In addition I don't know if you are interested but I made a modification
which uses GDLib to resize the images when they are uploaded so they are
smaller than a specified dimension. So for example if you wish to use this
on a forum and you don't want images bigger than for example 500px x 300px
this modification will resize all the images smaller than this as they are
uploaded.

I used this to stop people posting crazy sized images.

Let me know if you wish to add this code.

Thanks

Daniel


Date: 2008-06-05 11:15
Sender: tadejkan


Yes, that sounds great ;)
I don't know how I missed that :D That piece of code was written a long
time ago :P
Thanks :)

Regards,
Tadej


Date: 2008-06-05 11:00
Sender: neonhorizon


Hi Tadej,
I hope you don't mind me contributing to your code again but I found a
solution to the image resize problem.

It uses the css max-size setting. Unfortunatly but because this does not
work in IE6 we also need some javascript.

The first thing we need to do is change the config file so we have:
$file_width = "96";

This is because we need to loose the "px" part for our javascript. This
does mean we cannot use a % anymore but I think this is a worthwhile
sacrifice?

Then in the image browser include file please add this setting just below
second $count = 0; line.

$style="
width:expression( ((this.width > this.height) && (this.width > "
. $file_width . "))? \"" . $file_width . "px\" : true );
height:expression( ((this.height > this.width) && (this.height >
" . $file_width . "))? \"" . $file_width . "px\" : true );
max-width: " . $file_width . "px;
max-height: " . $file_width . "px
";

Then we need to change the echo line to this:
echo "<td align='center'><a class='file' href='#'
onClick='fileSelected(\"" . $requested_dir . $files[$i] . "\");'><img
src='" . $dir . "/" . $files[$i] . "' style='".$style."'
border='0px'></a><br><a href='#' onClick='delete_file(\"" . $files[$i] .
"\")'><img border=0 src='" . $delete_image . "'></a> " . $files[$i] .
"</td>\n";

So basically we remove the width= setting and add some style settings
instead.

The way it works is the max-width and max-height settings work for FFox
and IE7 and for old IE the javascript finds whether the image is wider or
taller and sets either width=$file_width or height=$file_width so we do not
get the image resized without keeping the proportions.

The solution is not very nice because non IE6 browsers have to ignore the
expression( function but it is the best solution I can think of without a
server side image resize. I have tested in Firefox 2, Safari 3, IE6 and IE7
using Windows and it seems to work OK.

Thanks

Daniel


Date: 2008-06-05 08:48
Sender: neonhorizon


Oh I did not confirm my new account oops...
OK this should be from my account and not 'nobody' now :)
*laugh*

Daniel


Date: 2008-06-05 08:45
Sender: nobody

Logged In: NO

Hi Tadej,

I thought I should probably create an account rather than use nobody to
help you fix the path problem...

On line 46 you should change this to:
if (strpos($dir, "..") !== false) //'..' in our path is a big no-no
$dir = $default_dir;

..because 0 can also be the 1st character position in the string.

However now this is working this causes a new problem if $default_dir
taken from the settings file contains a ".." as $dir is set as $default_dir
. "/" . $requested_dir on line 44.

I think the best solution is to change lines 38 to 47 to the following...

if (!isSet($_REQUEST["dir"]) || strlen($_REQUEST["dir"]) == 0 ||
strpos($_REQUEST["dir"], "..") !== false) {
$dir = $default_dir;
$requested_dir = "";
}
else {
$requested_dir = $_REQUEST["dir"] . "/";
$dir = $default_dir . "/" . $requested_dir;
}

...and remove old line 46 and 47 as the test is now on the first of the
new lines.

Also this way $requested_dir is also corrected.

How does that sound?

Thanks again for the nice utility...

Daniel





Date: 2008-06-05 07:53
Sender: tadejkan


Thanks ;)
Actually, if you look at line 46 of file_manager.php you'll find this
code:
if (strpos($dir, "..") > 0) //'..' in our path is a big no-no
$dir = $default_dir;
Which *should* prevent this kind of security hole ;) Have you found that
it isn't working properly?

Regards,
Tadej


Date: 2008-06-04 22:17
Sender: nobody

Logged In: NO

This is a really great piece of code, thanks!
I've been looking for something simple and easy to use like this for
ages!

The only thing I noticed is you can use
/file_manager.php?type=img&dir=../../../../ etc to see files/folders on the
system which are above the FileUpload directory, this maybe a security
problem? I think maybe this should be blocked?


Date: 2008-06-04 04:12
Sender: nobody

Logged In: NO

YOU ARE AWESOME~~! Thank you so much for this!


Date: 2008-05-30 19:35
Sender: tadejkan


So .. no gold? :(
If you need any help, ask ;) No gold required .. :P

Regards,
Tadej


Date: 2008-05-30 19:12
Sender: nobody

Logged In: NO

Definitely a compliment. Installed without a hitch, easy to config!


Date: 2008-05-30 19:05
Sender: tadejkan


Was this meant as a compliment, or have you just struck gold in your
backyard? :P If so .. what's your address? :P

Regards,
Tadej


Date: 2008-05-30 16:35
Sender: inmediagroup


GOLD!


Date: 2008-04-04 10:21
Sender: fyankai


This is true! Well I'll keep testing and let you know if anything comes
up. But all looks great so far...

Thanks, Frank


Date: 2008-04-04 10:16
Sender: tadejkan


Actually, I never said that - I simply didn't have any time to *test*
whether or not it works ;) And I'm very happy to hear that it does :)

Regards,
Tadej


Date: 2008-04-04 09:24
Sender: fyankai


Brilliant plugin - does everything I want it to do!

You say it's not compatible with tinyMCE 3.x, but I've been using them
together and not found any problems yet. Does anyone know of any issues?

Thanks, Frank


Date: 2008-03-29 10:06
Sender: tadejkan


No, sadly I did not have the time, required to test it with version 3 of
TinyMCE. I am, however developing a new version - a complete rewrite - but
it's taking much too long, solely due to my lack of time :(
The new version will be compatible with version 3 of TinyMCE. I will try
and get the new version out asap.
The updates you mentioned aren't ready for posting here, but I'd be happy
to help you with any specific problem/feature request you might have.

Regards,
Tadej


Date: 2008-03-29 05:36
Sender: metzen2k


Has this been updated to be compatible with version 3 of TinyMCE?

I see you have done some updates (like confirm delete for JJ), do you mind
posting your latest version?

Thanks,
Brian


Date: 2008-03-07 16:43
Sender: faravid


Mailed.


Date: 2008-03-07 16:23
Sender: nobody

Logged In: NO

Hi faravid

Thanks!

my email is jjames((a))mailshack.com

I look forward to seeing it

Cheers

JJ


Date: 2008-03-07 14:28
Sender: faravid


I have added that ability to the script myself, give me your e-mail
address and I'll mail it to you (it also has better script for resizing the
images and fix for oversized table in Opera).


Date: 2008-03-07 12:56
Sender: nobody

Logged In: NO

Hi

Thanks so much for this plug in, it really is fantastic!

Is there an easy way to implement an 'Are you sure you want to delete?'
dialog?

I am worried users may click on the little red X by accident, and if this
did happen the may not even know which file was deleted, and all links to
would be broken also.

I am not hugely experienced in coding, I do play around but thats about
all. I am not asking someone to code it etc, but if I could be given some
ideas that would be great.

And kudos on the plug in :)

Cheers

JJ


Date: 2008-02-10 22:55
Sender: tadejkan


Glad it's working ;)
Any suggestions/bug reports/whatever .. I'd be glad to hear them.

Regards,
Tadej


Date: 2008-02-10 20:04
Sender: nobody

Logged In: NO

Seems that I made a wrong setting. Fixed that, and now everything works
great!

Tnx for looking into it.


Date: 2008-02-09 05:52
Sender: tadejkan


What do you mean with that it doesn't display? Are you using the image,
and not the file browser?
What is your situation regarding directories where you keep your files?
How are they visible physically, and how virtually (through the web)?

Regards,
Tadej



Date: 2008-02-07 15:25
Sender: nobody

Logged In: NO

Hi,

I have a tiny problem with your, otherwise great working, plugin. If I
upload an image it doesn't display the thumbnail image. The actual image
however is uploaded, and I can choose it from your plugin and insert it
into tinymce. It image is also shown on the website itself, so no problems
there, only the thumnail isn't displayed correctly.

- Bert


Date: 2007-12-17 10:06
Sender: tadejkan


Thanks.
Glad you found the answer ;)
If you have any suggestion/bug report/question/whatever, I'd be happy to
hear it.

Regards,
Tadej


Date: 2007-12-16 23:03
Sender: nunobasto


Hi again,

I just edited file_manager.php and found the answer right in the first
line. ;)
Sorry about the precipitation.

Now I can say that this is the best plugin! :)

Regards.

Nuno


Date: 2007-12-16 22:53
Sender: nunobasto


Hi,

This is a great plugin for tinymce but I think there is a major security
problem. I use tinymce for some websites's content managers which require
login. But if anyone can access directly to filemanager.php and all the
files can be copyed and deleted. You just have to browse to
"file_manager.php?type=files&dir=../../". Is this a known problem or is
there anyway to pretect it?

Regards.

Nuno


Date: 2007-12-12 10:54
Sender: tadejkan


Hi.

Sorry for not responding, but the mail got stuck in Junk mail, again :S
You already got your answer, but if you have any more questions, don't be
afraid to ask ;)
Btw - I'm preparing a completely new version as I speak (erm, write), so
if anyone has any suggestions ..

Regards,
Tadej


Date: 2007-12-08 00:25
Sender: nobody

Logged In: NO

At the bottom of page.


Date: 2007-12-05 10:51
Sender: nobody

Logged In: NO

Where is the link to download this?


Date: 2007-11-21 13:35
Sender: tadejkan


Hmm, yes .. but the fact is, that UTF-8 is meant to be international, and
should display those characters properly (if you use the correct font - one
with unicode characters). Also, with ISO-8859-1, you're limiting yourself
to that character set. Which means that it's very hard to have an
international site with my file manager, because texts like "Current
directory" (when translated) have different characters in different
languages.

Regards,
Tadej


Date: 2007-11-18 12:12
Sender: faravid


I noticed a problem with scandinavian letters (öäå) in files and
folders, they are shown with a box (invalid character), this causes
problems with loading files and folders when you use those letters.

I thought about a filter to take the letters out since those letters may
not be compatible with every browser when loading files, same goes with
spaces and capital letters, but this is a simpler solution for newer
browsers.

They fail to show because content-type is set to be UTF-8, you can fix
this by setting content-type in file_manager.php to ISO-8859-1:

Example:
Old:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Fixed:
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">




Date: 2007-11-17 16:08
Sender: faravid


OK, E-Mail sent, check your inbox or junk mail folder. ;P

- Janne


Date: 2007-11-16 23:34
Sender: tadejkan


Sorry, your e-mail obviously got stuck somewhere (perhaps junk mail?).
I would appreciate you sending the modified version to my email. I hope it
goes through this time ;)

Regards,
Tadej


Date: 2007-11-16 12:17
Sender: faravid


Hello Tadejkan, I tried to contact you previously through E-Mail but no
answer.

I modified your script a little bit, I added confirm dialogs for delete
and made it understand image sizes better.
Also I added finnish language.

I can E-Mail the modified version to you, if you want.

- Janne


Date: 2007-10-31 14:52
Sender: nobody

Logged In: NO

Alex,
Make sure you're not loading the page from cache.


Date: 2007-10-26 22:58
Sender: tadejkan


Yes, you're correct - this file manager *could* be written as a plugin,
and I'll take a look at that for my next version.
But, it should work as it is right now, as is apparent from the test.html
file.
If you could, please try and start with test.html, as your starting point,
and then remove features.
If you can't do that, then you could also save your page as html, and send
it to me, and I'll take a look.

Regards,
Tadej


Date: 2007-10-26 09:11
Sender: nobody

Logged In: NO

Hi Tadej,

Thanks for your continued help.
We do not get any error at all, the file manager simply does not load up.
We tell that from the missing picture near the text fields where it should
be.
Our Tinymce init function is fairly easy: in the files where it is used
(an OS Commerce installation) the only content is "textareas". Nothing
else.
We added the file_browser_callback : "fileBrowserCallBack" line and,
subsequently in the same files, the function
fileBrowserCallBack(field_name, url, type, win).
No error, the file manager is ignored.
If we load up test.html in the same environment (site, php, web server)
everything's fine.
With making a standard plugin I mean make the file manager install in a
single directory within the Tinymce's "plugin" folder. When it is installed
it becomes available as a button like other plugins, and when I see the
button I know that the file manager 1) is working, 2) should have hooked
into the various dialogue windows/text fields.
Hope this makes sense...

Alex



Date: 2007-10-21 12:28
Sender: tadejkan


Actually, it *is* standard.
What did the javascript error say?
I think you should take another look at test.html, considering that it
works, and see what are the differences between test.html and your
implementation.
Start with test.html, then slowly, incrementally, add/remove stuff from
it. Debugging.

Regards,
Tadej


Date: 2007-10-20 23:55
Sender: nobody

Logged In: NO

Hi Tadej,

We checked for the call and by adding it we get a javascript error.
It's probably our fault, there must be some customization in our system
that prevents us from using your file manager though it does not affect
Tinymce.
We will skip the file manager for now (it is not an essential part of the
project we're working on) and try again in a few months.
A little suggestion is to make this a standard Tinymce plug-in. Are there
any problems with that? That would make installation as easy as possible
and prevent many like us from bothering. :-)
Thanks again for trying to help!

Alex


Date: 2007-10-20 14:06
Sender: tadejkan


Well, do you have the
file_browser_callback : "fileBrowserCallBack"
line in your tinyMCE.init .. ?
This line specifies which function it should call ..

Regards,
Tadej


Date: 2007-10-20 10:30
Sender: nobody

Logged In: NO

Hi Tadej, thanks for your prompt help.
We have put the mentione function immediately after every tinymce.init
instance, in the files where it is present, but with no results. The
'regular' Tinymce keeps loading up the standard "add image" window, with no
small icon to access the file manager.
Can you provide me with some further explanation?
Thanks again,

Alex


Date: 2007-10-20 05:36
Sender: tadejkan


Well, as far as I know, this function should be in the same place as
tinyMCE.init ...
Or it should at least be visible in the same scope.
The thing is, that this function get called automatically from tinyMCE ..
so in theory, it should be somewhere, where tinyMCE can find it (god only
knows where that could be, except in the same scope as tinyMCE - which we
know works - that's how test.html is constructed).
Hope I was of some assistance ;)

Regards,
Tadej


Date: 2007-10-19 10:28
Sender: nobody

Logged In: NO

Hi Tadej,

This could be the stupidest question but...
We installed your plug-in, the test.html loads up fine, clicking on the
"add image" button of Tinymce we can access the plug-in's functions.
Using the regular Tinymce already available on our site, clicking "add
image" loads up the regular, default image manager with no small icon to
access your file/image manager.
We looked at the code of test.html and found the following function which,
I understand, activates the file manager within Tinymce.
Could you be so kind to explain in which of Tinymce's files this should be
put and where within the file?
Thanks in advance for your availability and for writing this plug-in.

Alex

--------
function fileBrowserCallBack(field_name, url, type, win) {
var connector = "../../../file_manager.php";
my_field = field_name;
my_win = win;
switch (type) {
case "image":
connector += "?type=img";
break;
case "media":
connector += "?type=media";
break;
case "flash": //for older versions of tinymce
connector += "?type=media";
break;
case "file":
connector += "?type=files";
break;
}
window.open(connector, "file_manager",
"modal,width=450,height=600,scrollbars=1");
}
------


Date: 2007-09-09 19:14
Sender: tadejkan


So .. is it working now, or are you still having problems? ;)

Regards,
Tadej


Date: 2007-09-09 15:10
Sender: markwoei


Mmms, I can't edit my posts...

I already made it work ;) Like I said, something stupid :P

:)


Date: 2007-09-09 15:01
Sender: markwoei


Hello there,

First of all, Big Thumbs Up for you m8. Nice work you do! ( Damn bad
English :D )
Anyway, I have a little problem here. I made it work in my TinyMCE.

When I click the Insert image button, it gives me a popup. Then I click on
the "Browse" button.... But my browser ( IE of FF ) wants toe download
file_manager.php....

It's probably something stupid...

Thanks in advance!


Date: 2007-08-14 14:14
Sender: tadejkan


Replying to last 2 comments:

"you should really display .."
I know it's very easy to do, but then there's the overhead of having the
thumbs somewhere .. with the current implementation, you can simply
copy/paste the images into the directory. The only I would imagine this to
be any good would be if it dynamically checked if it has the thumb, and
would generate it, if it didn't.. I'll think about your suggestions.

"is it possible with this plugin to upload multiple images at once? ..."
Well, it certainly is possible to upload multiple images at once .. that's
no big deal. The only problem is with the php timeouting ..
For this to be really plausible, I would probably have to upgrade to php5,
which offers much richer control over uploads (as far as I know, you can
monitor how much of the file has already been uploaded, which is hard to do
in php4).
If you know of a way to do this, I'd be glad to hear about it ;)

Regards,
Tadej


Date: 2007-08-14 13:59
Sender: nobody

Logged In: NO

is it possible with this plugin to upload multiple images at once? like
the official imagemanager from tinymce?
i would really like this..


Date: 2007-08-06 23:26
Sender: nobody

Logged In: NO

you should really dispay the image thumbnails...as actual thumbnails, not
just squeezed smaller. GD does that pretty easily. Also the way the
filemanager is set out is kinda bad. should be in a vertical tabular
form..I mean the most you can see at one time is 4 or 5 images. I know
these are easily implemented but they're just suggestions


Date: 2007-07-25 03:02
Sender: tadejkan


Well, they're only notices, as you might have .. erm .. noticed ;)
So, it's not really a problem, but to stop the notices from showing up,
you can do this:
add these lines:
$dirs = array();
$files = array();
just after (or before, it doesn't really matter) the line $dh =
opendir($dir); in file_manager.php.
This should fix it (although I'm writing this from the top of my head, so
.. ;))

Regards,
Tadej


Date: 2007-07-25 02:15
Sender: raindogs


Hi there,

This looks like a great plugin, thanks a lot for all of your hard work.
That said, I seem to be having some initial configuration problems. I have
set up all the files and directories *exactly* as instructed in the README
file, I copied the TinyMCE directory in, and navigated to test.html in a
web browser Everything comes up fine and the TinyMCE buttons show up.
However, when I click on the link next to the image text box, the file that
comes up displays the following error messages:

Notice: Undefined variable: dirs in
/srv/www/htdocs/mceTest/file_manager/image_browser_include.php on line 4

Notice: Undefined variable: files in
/srv/www/htdocs/mceTest/file_manager/image_browser_include.php on line 14

Any thoughts on what might be going wrong here?

Thanks!


Date: 2007-07-18 17:41
Sender: nobody

Logged In: NO

No. just double click test.html :))
regards, Dev


Date: 2007-07-18 14:40
Sender: tadejkan


You should be running my code over an http server, configured with php
support.
Did you simply double click the test.html?

Regards,
Tadej


Date: 2007-07-18 14:23
Sender: nobody

Logged In: NO

Hi
i have some problem with your script
pressing "browse" button IE trying to download from my PC file
file_manager.php


Date: 2007-07-12 11:20
Sender: tadejkan


Here's the promised demo -
http://tadej.inframe.si/tiny_mce_file_manager/test.html ;)
Uploading, as well as creating directories, should work.
You can see the file manager when creating links, and the image manager
when inserting images. They point to different directories.

Regards,
Tadej


Date: 2007-07-12 10:14
Sender: tadejkan


Good question ;)
I'll try and put a demo somewhere asap :)

Regards,
Tadej


Date: 2007-07-12 07:33
Sender: nobody

Logged In: NO

Is there a demo of this plugin?


Date: 2007-07-04 09:10
Sender: tadejkan


Ok, tnx for your thoughts ;)

Yes, please send it, I'll put it up along with the next release.
You can send it to tadej.kanizar ( at ) sagit-server.com.

Regards,
Tadej


Date: 2007-07-03 22:04
Sender: nobody

Logged In: NO

Aww, { and } that is. :-/

Slight improvement in the browser window:
body, html {
font-family: tahoma; font-size: 12px;
....



Date: 2007-07-03 21:54
Sender: nobody

Logged In: NO

Ah, of course ( and ), my bad. :)

Here's my thoughts of uploading file in picturebrowser:
a) Just javascript alert saying "Incompatible image format" and the temp
file is deleted
b) Javascript ok/cancel -box saying "Incompatible image format, do you
want to save it in file section?"
c) <input type="file" name="uploaded_file"
accept="image/gif,image/jpeg,image/bmp,image/png"> only in imagebrowser.
(not tested)

BTW, I made an finnish translation of lang file, maybe I should send it to
you?


Date: 2007-07-03 14:26
Sender: tadejkan


You should probably rewrite the if statement, adding { and } .. because
right now chmod gets executed regardless of the if statement, but your
indentation shows you probably meant to execute it only if the file was
successfully uploaded ;)

Yeah, it could do that .. I'll take that into consideration in my next
release ;)
It could be implemented in one of two ways - 1) a javascript
implementation, so it saves you a browser reload 2) in php
Probably the best way would be to combine both ways (javascript is very
easy to circumvent, of course ;)).
If you have any suggestions about how you'd like to see it implemented,
say so .. I'm open to all your feedback :)

Regards,
Tadej


Date: 2007-07-03 13:49
Sender: nobody

Logged In: NO

Hello,

I had problems with the file permissions, but solved it by adding
chmod-command after file upload:

if (move_uploaded_file($_FILES["uploaded_file"]["tmp_name"], $filename))
echo "<!-- file upload successful -->\n";
chmod ($filename, 0766);

Maybe I should put it after the create directory -thing?

And what about uploading non-picture files in picturebrowser? Maybe it
should check if uploaded file is a pic or not and alert about uploading
something that isn't picture?


Date: 2007-06-26 09:38
Sender: nobody

Logged In: NO

No problem, Tadej, we all appreciate the effort you put in creating the
plug-in.

Regarding the testing - it works fine so far, and none of the browsers had
attempted to mess up (IE 6.0, Opera 9.10, Mozilla Firefox 2.0.0.3).

Now I think I'll move onto the file (not image) upload, so may be I'll
have more questions ;)

Max.


Date: 2007-06-26 07:38
Sender: tadejkan


Well, I'm glad you were able to fix it :)
I've had very little time in the past few weeks, so I wasn't able to help
you :(

I'd be happy to hear again from you after you've tested this, so we'll all
know if it works correctly or not.

Regards,
Tadej


Date: 2007-06-26 05:33
Sender: nobody

Logged In: NO

Well, just as I thought, the answer is quite easy.
TinyMCE has special settings for URLs modifications (see FAQ:
http://wiki.moxiecode.com/index.php/TinyMCE:FAQ#Why_is_my_paths_incorrect.2C_I_want_absolute.2Frelative_URLs.3F).
So, in my case, init setting "convert_urls : false" seems to do the trick.
However, I'll still need to test more, as the manual says some browsers may
try to auto alter URLs.

Max.


Date: 2007-06-14 12:16
Sender: nobody

Logged In: NO

> I'll try and test this out a bit.

Tadej, thanks!
(btw my name is Max)

Yes, I also think that it's probably TinyMCE's fault. I just thought maybe
you've already encountered this url-changing feature (if it's a feature)
while working on your plugin.

So, if you have a chance to take a look and find something, please let me
know.
Regards,
Max.


Date: 2007-06-14 11:54
Sender: tadejkan


Hmm, weird.
Well, if the url is correct in the insert/edit image window, and gets
changed only *after* pressing the insert button, then it's TinyMCE's fault.
It probably detected your current url, and decided to cut away what wasn't
needed..
I'll try and test this out a bit.

Regards,
Tadej


Date: 2007-06-14 10:52
Sender: nobody

Logged In: NO

> Simply set "url_dir" to your http address
Sorry, maybe I used somehow incorrect term for the path.

What I'd like is, the path to the image to be stored like <img
src="/my_site/FileUpload/pics/my_img.gif"> (with the leading slash, so the
path would start from webserver root dir).

When I set "url_dir" in file_manager_config.php to
"/my_site/FileUpload/pics/", your plug-in seem to generate the src string
for "Image URL" input field in a right and desired way.
However, after I click "Insert" button of "Insert/edit image" window, this
string seems to be converted to just "FileUpload/pics/my_img.gif" (I can
see this in TinyMCE's HTML view).

So, what seems to be the reason, why the src string is changed? Does your
plug-in or TinyMCE do this?


Date: 2007-06-14 09:14
Sender: tadejkan


Yes, of course there is ;)
Simply set "url_dir" to your http address ..
http://yoursite.com/files/subdir/image.jpg, where subdir/image.jpg is the
image, relative to the "dir" setting.
For example:
"dir" is set to "/htdocs/site/uploads/files/"
We have an image, which we want to display .. it's uploaded in the "test"
subdir .. the full path is now "/htdocs/site/uploads/files/test/image.jpg"
We've "url_dir" to "http://oursite.com/images/"
The url of the image will now become
"http://oursite.com/images/test/image.jpg"

Regards,
Tadej


Date: 2007-06-14 08:06
Sender: nobody

Logged In: NO

Tadej, thanks a lot for the plug-in! Looks very useful so far.
But I have a question...
Is there a way to make it generate absolute, not relative paths to an
image?
Because, say, if we use TinyMCE with your plugin for a content management
system on a website, and this CMS is located in /cms directory relative to
the website root directory. We'd like to WYSIWYG the images in TinyMCE and,
surely, have them visible on the web site. I think absolute paths seem to
be most natural solution here.
Or am I missing something? Sorry, I'm not really an expert with TinyMCE.


Date: 2007-06-10 11:36
Sender: nobody

Logged In: NO

@Tadej:
OK, I wait with pleasure for a solution.
And yes, the IE has his own quirks.
Many thanks for your efforts.

Crazy Horse


Date: 2007-06-09 22:18
Sender: tadejkan


@Crazy Horse:
I'm still trying to debug the damn bug ;) IE is strange, to say the least
:P

@nobody:
Was it a php error, or a javascript error? Because there's nothing really
on line 11 of the file_manager.php.
So you were able to upload the picture, and it showed up on the list? The
error came up after clicking the picture, right?

Regards,
Tadej


Date: 2007-06-09 17:11
Sender: nobody

Logged In: NO

Error when I select the picture... Private: (?)
No
After I have uploaded my picture and I click it to insert it. It gives me
a permission denied error.

line 11
char 2
error permission denied
code 0
url http://mypath/tinymce/fillemanger.php?type=img&dir=test

I have the entire directory set to chmod 777.
don't know what to do from here..
Please help!!



Date: 2007-06-07 09:26
Sender: nobody

Logged In: NO

Hallo Tadej,

o.k.
Then I wait for an update and calls in later once again.

greets, Crazy Horse


Date: 2007-06-07 08:53
Sender: tadejkan


That's ok, I'm not a native speaker, either.
I'll look into the IE6 problem .. it's probably just a simple javascript
problem ;)

Regards,
Tadej


Date: 2007-06-07 07:59
Sender: nobody

Logged In: NO

Hallo Tadej,

thanks a lot for your solution, that is what I'm looking for.

Firefox Version 2.0.0.4
I have done the things you told me, and now I can insert some Text
to my tiny mce textarea from the InsertTextWindow and I can select a File
width the FileBrowser too. That works fine.

but...

IE Explorer 6.0
1. InsertTextWindow: when I click the button to insert the Text nothing
happen's.
2. The Window of the FileBrowser opens - it works - but when I click a
link
to select a File, the selected File does not display in the
InserTextWindow.

What can I do now?
Sorry for my bad english but it is a long time ago since I went to
school.

greets,

Crazy Horse


Date: 2007-06-06 11:32
Sender: tadejkan


I've attached a file (check at the bottom of the page) - inserttext.zip.
Unzip this to your plugins dir of the tiny mce directory.
Then, go to your html where you call tiny mce - check the function
tinyMCE.init({ ...
And take a look at plugins : "table, ....
Here, you should add inserttext .. now, this line should like something
like

plugins :
"table,advhr,advimage,advlink,flash,paste,fullscreen,noneditable,contextmenu,inserttext",

Also, you have to add the button somewhere .. for example ..
theme_advanced_buttons3_add :
"flash,advhr,separator,fullscreen,inserttext",

When you click the button, it'll show a window .. here, you can insert
some text, and it'll be inserted into the tiny mce textarea. Also, you can
click the browse button, and it should open my file manager, using the
"files" configuration (you know, the one from file_manager_config.php).
Upon selecting a file, it should load the contents of the file into the
textbox in the window - then you simply click "insert text", and it should
insert that text into the tiny mce textarea.

I hope it works .. please, give me some feedback, and I'll put this up as
a separate plugin.

Hope my instructions were clear enough ;)

Regards,
Tadej
File Added: inserttext.zip


Date: 2007-06-06 08:46
Sender: nobody

Logged In: NO

Hallo Tadej,

Thank you for your fast answer.
I spent the better part of yesterday trying to
understand the code... your FileManager works very well.

But what I'm looking for, is a Plugin which is able to include
some data in the tinymce-textarea, for example a textfile.
I will not create a link to a file on the server and I will not
include some images or swf-files.

So what can i do, to create a link in the mainmenue which opens a
new window where I can browse different Datafiles?
I take a look at the "Manage Standard Text Snippets Plugin"
(id = 1676432) but it seems the plugin works not very well.

I hope my question is clear enough ?


greets...

Crazy Horse


Date: 2007-06-05 16:30
Sender: tadejkan


If you take a look at file_manager_config.php, you'll notice a line, which
starts with
$settings["files"]["type"]
There are other similar lines (which also end with ["type"]) .. this
["type"] tells my file manager if you want to use a file manager
($settings["files"]["type"] = 1;) or an image manager
($settings["files"]["type"] = 2;).
This value (1 or 2) actually refers to the $types array in the same file.
"files" can actually be anything you like, but you have to call my file
manager using this - if you take a look at test.html, and the function
fileBrowserCallBack, you'll see that if we want to open my file manager for
the type "file", it'll call "?type=files". And this is the "files"
mentioned before ..
TinyMCE calls fileBrowserCallBack with the type parameter set to "file"
whenever you try to create a link, and click the browse button there.
So, using my default configuration, it should display the file manager,
instead of the image manager, whenever you're creating links.
My exaplanation probably contains some holes (I'm a programmer, not a
professor :P), so please ask again, if it wasn't clear enough ;)

Regards,
Tadej


Date: 2007-06-05 14:00
Sender: nobody

Logged In: NO

Hallo,
This is working great for me but i have one problem.
Image,- and SWF-Files works fine but what about the Filebrowser ?
(for exampke textfiles?) It seems there is no button in my menü for this
option.
Sorry for my english, I'm from Germany...

I use the default settings.

Thanks a lot...

Crazy Horse



Date: 2007-05-21 09:39
Sender: nobody

Logged In: NO

Thanks!

simple use of strpslashes wash enough.


Date: 2007-05-19 18:38
Sender: tadejkan


I believe you're experiencing this problem due to having magic quotes
(http://www.php.net/manual/en/security.magicquotes.php) turned on in your
php.ini. This setting automatically adds \ to ".

Regards,
Tadej


Date: 2007-05-19 16:23
Sender: nobody

Logged In: NO

Hi,

This is working great for me but i have only one problem. When editting
with TinyMCE
everthing is working fine and the image is shown. But when i look in the
sql database
it says something like: <img src=\"FileUpload/pics/euro.jpg\" alt=\"euro\"
title=\"euro\" width=\"90\" height=\"90\" />
There are too much slashes in between. So when i want to show this
information on my website there's no
image.

Is this a problem in this code or in the code from TinyMCE?

Thanx in advance!


Date: 2007-05-17 01:13
Sender: nobody

Logged In: NO

To avoid the error...

Add to "image_browser_include.php" and "file_browser_include.php" the
following line insite de <?php tag.

error_reporting(0);

Cristián Dagnino



Date: 2007-05-03 17:21
Sender: tadejkan


Actually, it seems the mail server is offline right now .. please try in a
day :S

Regards,
Tadej


Date: 2007-05-03 14:53
Sender: nobody

Logged In: NO

I've sent it, but perhaps you can't become it, because it contains a zip
file. Can you check this please?


Date: 2007-05-03 09:30
Sender: tadejkan


I've written my email in my previous reply, so you can send it there ..
;)

Regards,
Tadej


Date: 2007-05-03 08:41
Sender: kaktuspalme


Ok, sorry for so much submits today, but i've fixed the specified bugs
i've written bottom.
I've simply made a if(isset($dirs)) { in image_browser_include.php
and ive added a german language file.
How can i send you my zip file?


Date: 2007-05-03 08:37
Sender: tadejkan


You can send it to tadej.kanizar ( at ) sagit-server.com .. tnx for the
translation ;)
I'll take a look at that error ..

Regards,
Tadej



Date: 2007-05-03 08:35
Sender: kaktuspalme


Ok, i've found why it comes this error message, if there is no file in the
folder with the specified extensions, it comes the error, if there is no
directory in folder pics, it comes the second error.


Date: 2007-05-03 08:01
Sender: kaktuspalme


I've made a translation to german, how can i send you?


Date: 2007-05-03 07:52
Sender: kaktuspalme


I get this error if i open the filemanager:

Notice: Undefined variable: dirs in
D:\wwwroot\kaktus\newsletter_send\jscripts\file_manager\image_browser_include.php
on line 4

Notice: Undefined variable: files in
D:\wwwroot\kaktus\newsletter_send\jscripts\file_manager\image_browser_include.php
on line 14

Perhaps its a propblem with the IIS Server(I hate IIS, but i have here no
choice).


Date: 2007-04-17 16:15
Sender: tadejkan


Added a new version - only file_manager_config.php changed .. it now says
you have to include the trailing slash in ["dir"].
Thanx mr_pomme for the bug report ;)

Regards,
Tadej
File Added: file_manager.zip


Date: 2007-04-17 07:53
Sender: tadejkan


Tnx for the feedback.
I'll take a look at that bug. I should really get a tester to iron out
those bugs :P

Your language pack and theme will be great additions to this plugin :)

Regards,
Tadej


Date: 2007-04-17 06:50
Sender: nobody

Logged In: NO

Thnx


Date: 2007-04-17 01:18
Sender: mr_pomme


Hi , thanks for the script .
I've had it virtual path for my user.
I've found one little bug to upload à files into a new created files but
easy to correct it:
ex:
My root dir:
/upfiles/img/zabou/
If I create some subdirectory news16avril
If I upload it make one error in the move_uploadfile because it try tu
move to /upfiles/img/zabounews16avril

To correct it , just add the trailing to $setting["img"]["dir"].
I've make a language pack for french, as soon I've make a great theme and
improve it's security I'll share it ;)




Date: 2007-04-15 07:33
Sender: tadejkan


Bitte ;)


Date: 2007-04-15 03:12
Sender: nobody

Logged In: NO

Danke


Date: 2007-04-14 21:22
Sender: brochris


That's weird. I guess I just had a setting somewhere that was messing it
up. It's all good now...and don't intent to change anything :) It's
working, and that's all that matters :)


Date: 2007-04-14 20:23
Sender: tadejkan


It has no license at all :P
So .. do whatever you want with it ;)
But, as a courtesy, you could put a small little writing somewhere saying
it was made by TadejK :P If it doesn't go with your design, or whatever,
you don't have to do that :)

Regards,
Tadej


Date: 2007-04-14 18:38
Sender: nobody

Logged In: NO

Hi Tadej,

I would like to use your plug-in in a CMS. Under what kind of license is
your project distributed? Is it LGPL like tinyMCE or something else?

Regards,
Igor


Date: 2007-04-14 16:40
Sender: tadejkan


I tested the problem with / being added .. I'm not seeing it here, hmm.
Could you please explain a bit more what the problem is, and how to
reproduce it?
Thanks.

Regards,
Tadej


Date: 2007-04-14 16:34
Sender: tadejkan


Oh, about the swf inserting .. check test.html for modifications .. you
have to have 'case "media":' in the javascript, along with 'case "image"'
and 'case "file"'.
Also, file_manager_config.php has been modified - $settings["flash"] has
been changed to $settings["media"] ..

Otherwise, it should work, because I've just tested it on 2.1.0, and it
works .. ;)

Regards,
Tadej


Date: 2007-04-14 08:23
Sender: tadejkan


Hehe, good for you :D
I'll try and check this out asap .. and I obviously have to begin testing
on the 2.1.0 ;)
So currently you have two problems (if we don't count your little hack)..
1) swf inserting is broken
2) / is added to 'filename' if url_dir is set to ""

Anything else?

I'll be happy to include your skin ;)

Regards,
Tadej


Date: 2007-04-14 03:06
Sender: brochris


I still couldn't get it to work. The new version also broke swf inserting
for me. I am using version 2.1.0 of TinyMCE, so maybe that has something
to do with it.

I have good news, though! I spent the better part of today trying to
understand the code, and I was able to get things working for me (using the
version two previous to the current version). For some reason, unbeknownst
to me, a / is added to the beginning of the JavaScript variable 'filename'
when url_dir is set to "". So, I added the following line as the first
line of the function fileSelected(filename) (line 76):

<?php if($url_dir==''){ ?>var filename = filename.substring(1);<?php } ?>

This fixed it! I'm so happy I could shout! But my wife's sleeping, so
that probably wouldn't be a good idea. Thanks again for putting this file
manager together. When I finish the skin, I'll let you know so you can
include it if you want.


Date: 2007-04-13 07:54
Sender: tadejkan


I've just uploaded a new version ..
These things were fixed:
- fixed url_dir problem with slashes (you have to include the trailing
slash in url_dir now!)
- deleted onresize function
- moved back to the old code for showing images in image browser, because
the current wasn't working good enought ;)

I've tested the bug, when the file manager refuses to close, but haven't
been able to replicate it .. probably something to do with the newer
version of tinymce (I'm testing with 2.08)

Please report any other bugs ;)

Regards,
Tadej
File Added: file_manager.zip


Date: 2007-04-13 07:03
Sender: tadejkan


Ah, don't be sorry .. if there are any bugs, they need to be fixed ;)
I'll take a look at these bugs right now.
As for commenting out that line - you can safely comment it out, the only
ramification is, that when you'll choose a picture, it won't show up in
tiny mce right away (I mean in the Edit Image window ..). It looks like it
won't close because line 76 represents an error .. have to test that a bit
;)
Btw - which error, and which version of tiny mce, are you using?

Oh, and about the resize function - you can safely delete that (that is,
lines from 85 to 96), as that was just a forgotten experiment ;)

Regards,
Tadej


Date: 2007-04-11 21:29
Sender: brochris


Sorry to bring up more bugs. It appears to strip all slashes from the url
now. This is good when linking to a file in the root directory, but when
trying to display an image, the url looks something like:
imagesfilename.jpg rather than images/filename.jpg

Also, upon selecting a file, the file manager does not automatically
close. If I comment out line 76 in file_manager.php, it will close:

// window.top.opener.my_win.document.getElementById(window.top.opener.my_field).onchange();

I know very little JavaScript, so I don't really know what ramifications
commenting out this line has, but I noticed that it was added from the last
version, and commenting it out worked. I also noticed a funtion onResize
added. What does it do?

Other than that, everything looks great.


Date: 2007-04-11 15:15
Sender: tadejkan


Ignore the comment below, I've answered in the wrong thread :D

Regards,
Tadej


Date: 2007-04-11 15:13
Sender: tadejkan


Thanks, I'll think about that ;)
And if you have any other suggestions/error reports, just say so ;)

Regards,
Tadej


Attached Files ( 4 )

Filename Description Download
file_manager.zip Everything you need, except tinymce (and php runtime itself :P) Download
file_manager.zip Newer version Download
file_manager.zip Newer version Download
inserttext.zip Temporary file - will become it's own plugin Download

Changes ( 4 )

Field Old Value Date By
File Added 231952: inserttext.zip 2007-06-06 11:32 tadejkan
File Added 225333: file_manager.zip 2007-04-17 16:15 tadejkan
File Added 224797: file_manager.zip 2007-04-13 07:54 tadejkan
File Added 224555: file_manager.zip 2007-04-11 14:46 tadejkan