Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Sign In
Not a member yet? Click here to register.

Image src (url) problem in tinymce-editor and imagelist

I have problem with timymceeditor's image urls, facts:

1) images DO show alright in image administration page

2) images DON'T show alright in editor

3) images DON'T show always alright in editors imagelist preview

It is because image urls get messed up. They SHOULD be like:
http://my.domain/folder/images/image.gif
They become (depending on different 'solution efforts'wink either
http://my.domain/foldermy.domain/folder/images/image.gif
(see extra repetition and incorrect string concanation)
or
http:///my.domain/folder/images/image.gif
(see extra '/'-character there after http://)

Yes i know, I should get it right be following instructions on
http://tinymce.moxiecode.com/tinymce/docs/faq.html
but still i don' get.

Point is, I don't RECALL changing any of those relevant tinymceeditor's init variables before the problem occurred.
what does your site url look like in settings ?
In php fusion settings like:
http://my.domain/folder/
and phpfusion's index.php is in that folder. (Later i will direct the final domainname dirctly to that folder)

In tinyMCE init settings (administration/subheader.php) I have tried VARIOUS combinations to find solution, for example like:
document_base_url:'".$settings['siteurl']."',
relative_urls: 'false',
convert_urls: 'true',
remove_script_host : 'true',
...


I also looked now imagelist.js, which seems to be php-built file. Where is that php-command that builds that file?

Urls there were now like my.domain/folder/image.gif, without http://


Now I manually corrected the imagelist.js. It seems that list update process in image admin page doesn't work. I pushed the update link, but "changed"-timestamp in imagelist.js doesn't change forward.

Now, when image urls are corrected absolute in imagelist.js,
editor, ediror preview and article reading all work ok. This all would suggest problem in imagelist update. Maybe my site url for example for bad before, when update still worked.
<?php
// here is anyway new version of buildlist.php
// that works ok. check out function wic!
// is_dir and is_file need path from
// CURRENTLY EXECUTED FILE'S FOLDER
// to work right. without that, they always retun false.

/*---------------------------------------------------+
| buildlist.php - iLister enginge.
+----------------------------------------------------+
| Copyright © 2005 Johs Lind
| http://www.geltzer.dk/
| Inspired by: Php-fusion 6 coding
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------*/
if (!defined("IN_FUSION"wink) { header("Location: ../index.php"wink; exit; }

// images ------------------------

// THIS SMALL FUNCTION HELPS US GET RID OF
// '*.PHP', '*.JS', '..' AND '.' INTRUDERS IN IMAGEARRAY
// REMEMBER: IT NEEDS RELATIVE PATH FROM CURRENT FOLDER TO WORK.
function wic($path)
{
//Web Image Check
$parts = pathinfo($path);
$ext = strtolower($parts['extension']);
return(in_array($ext, array('jpg','jpeg','gif','png'wink) && is_file($path));
}

$temp = opendir(IMAGES);
while ($file = readdir($temp)) {
if (wic(IMAGES.$file)) {
$image_files[][0] = "['Images: ".$file."',";
$image_files[][1] = "'".$settings['siteurl']."images/".$file."'],\n";
}
}
closedir($temp);

// articles ---------------
$temp = opendir(IMAGES_A);
while ($file = readdir($temp)) {
if (wic(IMAGES_A.$file)) {
$image_files[][0] = "['articles: ".$file."',";
$image_files[][1] = "'".$settings['siteurl']."images/articles/".$file."'],\n";
}
}
closedir($temp);

// news -------------------
$temp = opendir(IMAGES_N);
while ($file = readdir($temp)) {
if (wic(IMAGES_N.$file)) {
$image_files[][0] = "['news: ".$file."',";
$image_files[][1] = "'".$settings['siteurl']."images/news/".$file."'],\n";
}
}
closedir($temp);

// photoalbum -------------------
$album = array();
$sql = dbquery("
SELECT ".$db_prefix."photo_albums.album_title, ".$db_prefix."photos.photo_id
FROM ".$db_prefix."photo_albums, ".$db_prefix."photos
WHERE ".$db_prefix."photo_albums.album_id = ".$db_prefix."photos.album_id
"wink;

while ($data = dbarray($sql)) {
$album[]=$data['album_title'];
$album[]=$data['photo_id'];
}

$temp = opendir(PHOTOS);
while ($file = readdir($temp)) {
if (wic(PHOTOS.$file)) {
$slut = strpos($file,"."wink;
$smlg = substr($file,0,$slut);
$navn = "";
for ($i=1;$i < count($album);$i=$i+2){
if ($smlg == $album[$i]) {
$navn = $album[$i-1];
break;
}
}
$image_files[][0] = "['".$navn." album: ".$file."',";
$image_files[][1] = "'".$settings['siteurl']."images/photoalbum/".$file."'],\n";
}
}
closedir($temp);


// compile list -----------------
if (isset($image_files)) {
$indhold = "var tinyMCEImageList = new Array(\n";
for ($i=0;$i < count($image_files);$i++){
$indhold = $indhold.$image_files[$i][0].$image_files[$i][1];
}
$lang = strlen($indhold)-2;
$indhold = substr($indhold,0,$lang);
$indhold = $indhold."wink;\n\n";
$fp = fopen(IMAGES."imagelist.js","w"wink;
fwrite($fp, $indhold);
fclose($fp);
}
?>
Thread Information
Author
Replies
6 posts
Views
2156 times
Last Post
Last updated on 13 years ago
Related Threads
You can view all discussion threads in this forum.
You can start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You cannot download attachments in this forum.