Re: Advanced image module for CuteNews
Find this:
//Rename image
if ($action == 'rename' and $image and $name){
and add below:
$name = str_replace(" ", "_", $name);
Dear CuteNews Users! Please feel free to contact us via our new Feedback Form and please send information about bugs to our bug tracker.
You are not logged in. Please login or register.
CutePHP Forums → Script Feedback and Suggestion → Advanced image module for CuteNews
Find this:
//Rename image
if ($action == 'rename' and $image and $name){
and add below:
$name = str_replace(" ", "_", $name);
ok, that code does what it is supposed to do,
but it doesn't really solve the problem at hand.
Because we actually do want the space to be there.
The new image module definitely works the way I want
with a old cutehack install I did a while back.
Bluehost says its in the script. They do allow spaces in file names.
...and just last night, I was checking out a cutenews.ru install
and spaces in file names seems to work fine by default.
Didn't you make that one? I am curious how you were able to
get it to work on there?
A number of people have asked about sorting the uploaded images by date rather than alphabetically. The solution I've seen is to replace natcasesort($images_in_dir); with rsort($images_in_dir);. This works for some but not others. The reason is that readdir() returns filenames in the order in which they are stored by the filesystem, which is not necessarily in chronological order.
My solution
Find:
$img_dir = opendir($config_path_image_upload);
$i = 0;
while ($file = readdir($img_dir))
{
$img_name_arr = explode(".",$file);
$img_type = end($img_name_arr);
$img_name = substr($file, 0, -(strlen($img_type)+1));
if ((in_array($img_type, $allowed_extensions) or in_array(strtolower($img_type), $allowed_extensions)) and $file != ".." and $file != "." and $file != "." and $file != ".htaccess" and $file != "index.html" and is_file($config_path_image_upload."/".$file))
//Yes we'll store them in array for sorting
$images_in_dir[] = $file;
}
Replace with:
// glob files in folder, modify brace to add extensions
$images_in_dir = glob("$config_path_image_upload/*.{jpg,png,gif}",GLOB_BRACE);
//sort by modification date descending
array_multisort( array_map( 'filemtime', $images_in_dir ),SORT_NUMERIC,SORT_DESC,$images_in_dir);
//glob grabs full_path/filename, need to remove path part
foreach ($images_in_dir as &$full_path_name) {
$full_path_name = basename($full_path_name);
}
unset($full_path_name); // clean up reference
Find and delete:
natcasesort($images_in_dir);
reset($images_in_dir);
Edit the {jpg,png,gif} brace to allow the extensions you want. This does not replace the need for the $allowed_extensions variable since that is used elsewhere. You must set both.
This doesn't test whether a name returned is a file or directory, but as long as you don't have directory names with graphic extensions it won't matter.
hey all
I also you this hack which is great
however I was wondering, how to make that the actual link
does display the "link colors" from the .css file... ?!
I tried by opening the function.inc.php
and edditing the folowing
/* 19 */ "[url=]\\1[/url]",
with
/* 19 */ "[url=]\\1[/url]",
class=textlink
is in the .css file
but it does not use it from the css, instead it uses a very dark-underlined-blue color for a link!
Any ideeas??
you'll need to edit the images.mdu if you're using the wysiwyg.
see parameter
finalImage
Note sure where you have that line you're posting.
hey i have an issue ive read it once, but i cant find it, when i insert an linkable image it appear at the end of all the text and not where my text pointer were like:
for example where says ''((((cursor)))'' is where i point the text cursor
texto texto texto texto texto
texto texto ((((cursor))) texto texto texto
texto texto texto texto
texto texto texto texto texto
but when i insert the picture, it appear at the end of the text
texto texto texto texto texto
texto texto ((((cursor))) texto texto texto
texto texto texto texto
texto texto texto texto texto
(((image)))
and not near the ((((cursor)))
do im clear?
reagrds
That's normal. There's not much that can be done about it.
thing is thta ive solve that once, thats the problem it can be done, your wrotwe about it, but i cant find it! please!!!
i am getting the following error:
Warning: getimagesize(./data/upimages/test.gif) [function.getimagesize]: failed to open stream: No such file or directory in /home/website/public_html/blog/inc/images.mdu on line 809
i have run php_info on the webserver and file_uploads is set to yes, not sure whats happening sad.gif
do you have that file test.gif?
do you have that file test.gif?
yeah, im using http://www.google.co.uk/intl/en_uk/images/logo.gif for test.gif
?? the advanced imge modle does use images that are on YOUR server, not elsewhere.
?? the advanced imge modle does use images that are on YOUR server, not elsewhere.
yes, i have an image saved on my local machine which i then try and upload in the "Manage Images" section to the webserver and then get the error as mentioned above.
hey i have an issue ive read it once, but i cant find it, when i insert an linkable image it appear at the end of all the text and not where my text pointer were like:
[...]
I think this is the relevant code. In the advanced image module you have this
MYRTE=window.opener.document.getElementById(area).contentWindow;
window.opener.currentRTE=area;
MYRTE.document.body.innerHTML += link1 +\"<img border=\\\"\"+ imageBorder +\"\\\" align=\\\"\"+ imageAlign +\"\\\" alt=\\\"\"+ alternativeText +\"\\\" hspace=\\\"\"+ hSpace +\"\\\" vspace=\\\"\"+ vSpace +\"\\\" src=\\\"".$config_http_script_dir.substr($config_path_image_upload, 1)."/\"+ path +\"\"+ selectedImage +\"\\\">\" + link2;
The image link is just appended to the end of the content in the text area.
The original images.mdu code is a bit different
MYRTE=window.opener.document.getElementById(area).contentWindow;
window.opener.currentRTE=area;
MYRTE.document.execCommand('InsertImage', false, '-my-temp-img-url-');
replacement = \"$config_http_script_dir/data/upimages/\" + selectedImage + \"\\\" alt=\\\"\" + alternativeText + \"\\\" border=\\\"\" + imageBorder + \"\\\" align=\\\"\" + imageAlign;
MYRTE.document.body.innerHTML = MYRTE.document.body.innerHTML.replace(/-my-temp-img-url-/gi,replacement);
Some placeholder text (-my-temp-img-url-) is inserted at the current insertion point. Then this is replaced by the image link.
I haven't tried to edit this and make it work for the advanced. I also wonder what is the purpose of inserting the placeholder text. Why not just construt the image url and then use that in the execCommand statement?
yes, i have an image saved on my local machine which i then try and upload in the "Manage Images" section to the webserver and then get the error as mentioned above.
Ah, you're uploading an image!! Nice of you to let us know.
in that case you should ask your host. The upload form is coded correctly, so the problem must lie with a certain setting of the server. Your host has logs etc that can help them find the problem.
Hello. great mod!
Can you point me what i should edit to change default settings like this:
Image Properties>hspace to 0
and Width of the thumb, because i every time change this value, its not comfortable.
And add some own tag to <img ..>
And two problems more:
1.What do to make window do not close after insert picture?
2.How to sort all existing images by name, but reversed, or remember page, when i stop last time. Because i uploading images, numbered like 1,2,3.... and the last uploaded image placing at the end of the list(last page).
thanks for the answers!
1)
window.close();
remove it.
2) it should sort by name allready. this will reverse the list
natcasesort($images_in_dir);
adding
rsort($images_in_dir);
Allright! But it a problem with sort by name:
9
8
7
6
5
4
3
23
22
21
20
2
19
18
..
How make to display last uploaded in top of the list?
natcasesort($images_in_dir);
maybe by deleting this line.
like this?
//Yes we'll store them in array for sorting
$images_in_dir[] = $file;
}
if($images_in_dir){
reset($images_in_dir);
//Pagination
it just sort by name as i post before https://cutephp.com/forum/index.php?s=&...st&p=131475
like this?
yes.
btw you either sort by name or by uplaoded. Not both.
Hi there,
Thx for a great module! All is great exept one thing.
When I´m in "Add news/Insert image" the module wont list all of my pictures. It only shows the first 250 pictures. Is there a limitation of thumbs?
250?
Isn't there a setting (inside images.mdu) to limit the amount of images per page? I believe there is.
And the hack doesn't limit to just 250. it limits to the set number, or it stops loading when the server says it doesn't want to continue anymore.
250 pictures are alot, and do take some time to load. Server have a max execution time meaning, if the requested page isn't loaded within that time, it just stops loading the rest.
Hi there!
Is it possible to open clickable thumbs with Highslide JS - or with a popup window?
Aready been posted:
https://cutephp.com/forum/index.php?showtopic=19619Works perfectly.
The link is dead to that topic... anyone able to show how it will work ?
Also is there anyway of making the thumbnail a max length on its longest edge and not just width ?
This is a great hack.
Thanks
Just what I needed. This is great. Thanks for sharing.
CutePHP Forums → Script Feedback and Suggestion → Advanced image module for CuteNews
Powered by PunBB, supported by Informer Technologies, Inc.
The pun_antispam official extension is installed. Copyright © 2003–2009 PunBB.