XWidgetSoft Forum
https://bbs.xwidget.com/

photo viewer - image name without the whole path
https://bbs.xwidget.com/viewtopic.php?f=8&t=3211
Page 1 of 1

Author:  Dagedee [ June 9th, 2013, 9:24 am ]
Post subject:  photo viewer - image name without the whole path

Hi,
I would like to show the name of every image in a photo viewer widget. Unfortunately it only seems to be possible to show the whole path of the image; e.g. C:\Users\Name\Images\ ...\ ...\ ...\image name.jpg. As pathes are often very long, it would be nice if there would be a way to "shorten" them. It would be great if someone knows a solution. Many thanks in advance. :)

Author:  Cov [ June 10th, 2013, 11:41 am ]
Post subject:  Re: photo viewer - image name without the whole path

Hey, I think this is a great idea! Image

Author:  meme [ June 10th, 2013, 1:44 pm ]
Post subject:  Re: photo viewer - image name without the whole path

When you say you want the image name, do you mean with or without the extension ?
e.g. C:\Users\Name\Images\ ...\ ...\ ...\image name.jpg
to return "image name.jpg" or "image name" only :?:

Author:  Dagedee [ June 10th, 2013, 2:06 pm ]
Post subject:  Re: photo viewer - image name without the whole path

Hi,
both versions, respectively one of them - (with or without file extention) would be ok. It would be great if you know how to do this! :)

Author:  meme [ June 10th, 2013, 2:42 pm ]
Post subject:  Re: photo viewer - image name without the whole path

Is this OK :?:
text2 in the displayed file name
relocate the // at the start of line two to line three to select with or without the file extension.

function photoalbumcore1OnUpdate(Sender)
{
var picpath = photoalbumcore1.get("%FileName");
// var picname = picpath.substring(picpath.lastIndexOf("\\") + 1,picpath.lenght); // with extension
var picname = picpath.substring(picpath.lastIndexOf("\\") + 1,picpath.lastIndexOf(".")); // without extension
text2.text = picname
}

Author:  Dagedee [ June 11th, 2013, 6:33 am ]
Post subject:  Re: photo viewer - image name without the whole path

Thank you very much!!! This is perfect! :D

Page 1 of 1 All times are UTC - 8 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/