Forum Index
RegisterSearchFAQMemberlistUsergroupsLog in
imagepath preview does not work in addnews page

 
Reply to topic    Forum Index » Bugs and errors View previous topic
View next topic
imagepath preview does not work in addnews page
Author Message
nam



Joined: 23 Dec 2006
Posts: 67

Post imagepath preview does not work in addnews page Reply with quote
In the avator field of the addnews page, I always add {imagepath}, but the image preview does not show up the picture. See the attached image to understand my problem:




You may notice the red cross in image preview section.
Mon Jul 07, 2008 4:27 pm View user's profile Send private message
Guest








Please login to hide the ads.

scottdallas



Joined: 04 May 2006
Posts: 1802
Location: US

Post Reply with quote
I didn't even know you could use {imagepath} there but don't you need a \ not a /

That probably isn't the answer to the question though Sad I add images a different way.. just noticed no one tried to answer this yet.

_________________
www.scottdizzle.com uses cnr Smile
last update: 07-22-08: 8:30 pm
Tue Jul 08, 2008 6:08 pm View user's profile Send private message Visit poster's website AIM Address
FI-DD
Admin


Joined: 22 Sep 2005
Posts: 2668
Location: Germany

Post Reply with quote
You can hardcode the image path into skins/cute.js:
Quote:
function showpreview(image,name){
if (image != ""){
document.images[name].src = 'here_comes_the_image_path'+image;
} else {
document.images[name].src = "skins/images/blank.gif";
}
}


After that you only need to add the name of the image, for example pic.jpg.
Thu Jul 10, 2008 6:25 pm View user's profile Send private message
nam



Joined: 23 Dec 2006
Posts: 67

Post Reply with quote
FI-DD wrote:
You can hardcode the image path into skins/cute.js:
Quote:
function showpreview(image,name){
if (image != ""){
document.images[name].src = 'here_comes_the_image_path'+image;
} else {
document.images[name].src = "skins/images/blank.gif";
}
}


After that you only need to add the name of the image, for example pic.jpg.



Thakns dear FI-DD, but this does not work for me. When I hardcode the imagepath, the image preview problem is solved in the addnews page, but the actual Avatar does not show up with the news item on the main web site. It tries to read the image from the main cutenews.ru folder where the avatars are not located.
Fri Jul 11, 2008 3:38 am View user's profile Send private message
FI-DD
Admin


Joined: 22 Sep 2005
Posts: 2668
Location: Germany

Post Reply with quote
Then you have to additionally hardcode the image path to the {avatar} tag in inc/show.news.php.
Fri Jul 18, 2008 9:41 am View user's profile Send private message
nam



Joined: 23 Dec 2006
Posts: 67

Post Reply with quote
FI-DD wrote:
Then you have to additionally hardcode the image path to the {avatar} tag in inc/show.news.php.


Thanks, but this is also not the solution, because If I hardcode the avator tag in the inc/show.news.php, then I have to remove all the {imagepath} tags from the previous posts, otherwise the avatars will not show up.

I was thinking of adding a piece of code in the above function, somthing like:

Code:
function showpreview(image,name){
   if (image != ""){

                                 IF image string has "{imagepath}/" in it
                                               do remove it
                                 
      document.images[name].src = 'data/upimages/'+image;
   } else {
      document.images[name].src = "skins/images/blank.gif";
   }
}

Fri Jul 18, 2008 2:20 pm View user's profile Send private message
nam



Joined: 23 Dec 2006
Posts: 67

Post Reply with quote
And finally I found the solution, this code worked well for me:

Code:
function showpreview(image,name){
   if (image != ""){
      image = image.replace(/\{imagepath\}\//, "");
      document.images[name].src = 'data/upimages/'+image;
   } else {
      document.images[name].src = "skins/images/blank.gif";
   }
}

Fri Jul 18, 2008 2:42 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    Forum Index » Bugs and errors All times are GMT + 1 Hour
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum



Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Music Lyrics.