Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Image tinyMCE
#26
Thanks for the input internet54. I’ll put it in my daring GetSimple built this afternoon (CET) if you don’t mind. Of course I’ll swap the hard-coded domain for the domain GetSimple is set to from the admin panel so it will work for everyone without having to tweak code.

I thought Chris already added the relative URLs setting? Apparently not.
“Don’t forget the important ˚ (not °) on the a,” says the Unicode lover.
Help us test a key change for the core! ¶ Problems with GetSimple? Be sure to enable debug mode!
Reply
#27
IMAGE LIST FEATURE ON TINYMCE

Hi Internet54, thanks for your reply

I have found a way to implement the IMAGE LIST feature, when you click on INSERT IMAGE of TinyMCE. **and** refreshing that lisk automatically.

1- Mofigy ADMIN/edit.php in order to add the IMAGE LIST (changes on bold)
// Theme options xxx
theme_advanced_buttons1 : "formatselect,styleselect,bold,italic,underline,justifyleft,justifycenter,justifyright,bullist,numlist,link,unlink,image,cleanup,removeformat",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
relative_urls:false,
external_image_list_url : "tinymce_image_list.php"
});

2- Fill list contens and make it dinamically update:
Create the file ADMIN/tinymce_image_list.php
with this content (i am also attaching the file to make it easy)

Code:
<?php // this must be the very first line in your PHP file!

// You can't simply echo everything right away because we need to set some headers first!
$output = ''; // Here we buffer the JavaScript code we want to send to the browser.
$delimiter = "\n"; // for eye candy... code gets new lines

$output .= 'var tinyMCEImageList = new Array(';

$directory = "../data/uploads"; // Use your correct (relative!) path here

// Since TinyMCE3.x you need absolute image paths in the list...
$abspath = preg_replace('~^/?(.*)/[^/]+$~', '/\\1', $_SERVER['SCRIPT_NAME']);

if (is_dir($directory)) {
    $direc = opendir($directory);

    while ($file = readdir($direc)) {
        if (!preg_match('~^\.~', $file)) { // no hidden files / directories here...
             if (is_file("$directory/$file") && getimagesize("$directory/$file") != FALSE) {
                // We got ourselves a file! Make an array entry:
                $output .= $delimiter
                    . '["'
                    . utf8_encode($file)
                    . '", "'
                    . utf8_encode("$abspath/$directory/$file")
                    . '"],';
            }
        }
    }

    $output = substr($output, 0, -1); // remove last comma from array item list (breaks some browsers)
    $output .= $delimiter;

    closedir($direc);
}

$output .= ');'; // Finish code: end of array definition. Now we have the JavaScript code ready!

header('Content-type: text/javascript'); // Make output a real JavaScript file!

echo $output; // Now we can send data to the browser because all headers have been set!

?>

This function will explore your DATA/UPLOADS/ folder, and create a list with its files.
You can change the code to only check for JPG PNG GIF files, and it will be nice helping clients on not link an IMG SRC to a PDF file...

thanks to TinyMCE WIKI on http://wiki.moxiecode.com/index.php/Tiny...e_list_url to show me the way Smile

should be this on scripts ?
Reply
#28
Very nice. Do you have a screenshot of what this looks like?

I believe it should only include images with those file extensions. If people want to add a pds or anything else, then they can goto the files tab and copy the url of the file they want and paste it into the page.

We need to get this CMS over some of the small hicups like this. However, I don't know if Chris is going to keep TinyMCE or not.
Clients always want to be able to change the content of their pages, but they are unwilling to do so.

Have you ever coded in your underwear before?
Reply
#29
yes, i attach a screenshot of IMAGE LIST

it actually show JPG and PNG pictures
Reply
#30
^ That is a very nice addition. Worth every penny Wink
Clients always want to be able to change the content of their pages, but they are unwilling to do so.

Have you ever coded in your underwear before?
Reply
#31
Very nice, we should really see to get this in the stable built. Will getting images to display so much more simple.
“Don’t forget the important ˚ (not °) on the a,” says the Unicode lover.
Help us test a key change for the core! ¶ Problems with GetSimple? Be sure to enable debug mode!
Reply
#32
Hi Zegnat
yes, I think it is a very important point for bringing it to clients that wants to compose their pages.
do you think is better to post it on scripts ?
Reply
#33
focoves Wrote:Do you think is better to post it on scripts?
You’re free to open a topic there and summarise every code edit from this topic. You never know who might want to use it!
“Don’t forget the important ˚ (not °) on the a,” says the Unicode lover.
Help us test a key change for the core! ¶ Problems with GetSimple? Be sure to enable debug mode!
Reply




Users browsing this thread: 1 Guest(s)