Use filename instead of title?

1,742 views
Skip to first unread message

Forrest

unread,
Sep 21, 2009, 4:04:02 PM9/21/09
to ResourceSpace
Is there a way to get RS to use filename instead of title? For
example, in search.php line 379, title is used. This is the page that
shows the "view all" for a collection. I would much rather every
instance of title be the filename instead. I've tried replacing this
with filename, basename, file, original_filename... but none of those
seem to work.

How can I get RS to use the file's name in place of where it uses
Title by default?

Thanks much

Forrest

unread,
Sep 23, 2009, 12:18:38 PM9/23/09
to ResourceSpace
So if this tweak as I described is that difficult, here's another
option.

How do you all deal with the Title field on batch uploads? It doesn't
make any sense for all of the assets to be given the same title. I
know I can make the field no longer be required, but that still
doesn't solve the issue.

Is there any trick to giving batch uploads unique filenames?

Thanks.

Kevin Relland

unread,
Nov 2, 2009, 9:06:06 AM11/2/09
to ResourceSpace
can anyone help on this as i'm interested in this solutions too
kevin

Ben Vanderberg

unread,
Nov 2, 2009, 9:55:33 AM11/2/09
to resour...@googlegroups.com
You are able to have unique names brought into RS by embedding the name into the "title" tag of the files. This includes DOC files, and any files that support XMP metadata. If there is something in the title metadata tag, it will replace that when bringing the file in. Not the most ideal, but it is a possible solution.

Kevin Relland

unread,
Nov 4, 2009, 8:27:19 AM11/4/09
to resour...@googlegroups.com
does anyone know if it is possible to do this without having to enter
the metadata in the 250000 files we hold?
Kevin

Tom Gleason

unread,
Nov 4, 2009, 9:15:58 AM11/4/09
to resour...@googlegroups.com
Is there an existing field that you would like to become the title?
There is always a way if so.

On Wed, Nov 4, 2009 at 8:27 AM, Kevin Relland

Ben Vanderberg

unread,
Nov 4, 2009, 12:26:05 PM11/4/09
to resour...@googlegroups.com
In response to your question, I tried changing the "Title" field to capture the filename by setting the ExifTool field to "filename". This worked, it pulled the filename with one little problem: it appears that ExifTool pulls the information after the file is moved into ResourceSpace and the file is renamed. So it can pull the name, but by default the filename is encrypted, which might not help you much, though that is a method you can pull the filename.

Ben Vanderberg

Kevin Relland

unread,
Nov 4, 2009, 1:02:03 PM11/4/09
to resour...@googlegroups.com
the original file is captured in the db and displayed in the file info
is this any help

On Wed, Nov 4, 2009 at 5:26 PM, Ben Vanderberg

Tom Gleason

unread,
Nov 4, 2009, 1:22:26 PM11/4/09
to resour...@googlegroups.com
hmm... well export your database and perhaps try this:

update resource r set title=(select value from resource_data rd where
resource_type_field=51 and r.ref=rd.resource);

That will store the original filename into the title field in the
resource table. However, there is some duplication of data in this
case, because you also want the title to be stored in field 8. You
could do a simple

update resource_data set resource_type_field=8 where resource_type_field=51;

and also there is a config option for
# Which field do we drop the original filename in to?
$filename_field=51;

which can be changed to
$filename_field=8;

for future uploads

Again, you'll want to definitely back up your database before trying
these things.

Tom

On Wed, Nov 4, 2009 at 12:26 PM, Ben Vanderberg

Tom Gleason

unread,
Nov 4, 2009, 1:25:50 PM11/4/09
to resour...@googlegroups.com
Another tip (since I noticed someone said you can't sort by title):
the default in config.php is:

$title_sort=false;

You can change that to true to have an alphabetical sort available for Title.

Tom

Kevin Relland

unread,
Nov 10, 2009, 10:03:43 AM11/10/09
to resour...@googlegroups.com
Hi Tom,
i thought this was working but i need it to populate both title and
file_path, do you know how this could be done
Cheers
Kev

Tom Gleason

unread,
Nov 10, 2009, 10:38:01 AM11/10/09
to resour...@googlegroups.com
I tried this:

UPDATE `resourcespace`.`resource_type_field` SET `resource_column` =
'file_path' WHERE `resource_type_field`.`ref` =8

but then the title doesn't get stored in the title column, only the
file_path column. A field was only intended to be mapped to one
column.

This whole duplication of certain data into the resource table is
something that is no longer technically necessary since I recently
added the ability to join data fields. However, this is an area where
the new functionality hasn't been brought to its logical conclusion
yet (eventually we'll have to find all instances of duped data coming
from the Resource table and replace them with data from
resource_data.)

You might try a hack to resource_functions.php,

line 520:

# Also update resource table?
$column=$fieldinfo["resource_column"];
if (strlen($column)>0)
{
if ($value=="") {$value="null";} else {$value="'" . $value . "'";}
sql_query("update resource set $column = $value where ref='$resource'");

### you could replace the above line with a hard-coded workaround: ###
sql_query("update resource set title= $value,
file_path=$value where ref='$resource' ");

}
}



On Tue, Nov 10, 2009 at 10:03 AM, Kevin Relland

Tom Gleason

unread,
Nov 10, 2009, 10:46:58 AM11/10/09
to resour...@googlegroups.com
actually you should probably replace that whole 'if' section:

## Also update resource table?
## $column=$fieldinfo["resource_column"];
## if (strlen($column)>0)
## {
## if ($value=="") {$value="null";} else {$value="'" . $value . "'";}
## sql_query("update resource set title= $value, file_path=$value
where ref='$resource' ");
## }
##}

sql_query("update resource set title= $value,
file_path=$value where ref='$resource' ");

Tom Gleason

unread,
Nov 10, 2009, 10:48:36 AM11/10/09
to resour...@googlegroups.com
sorry, not the last curly brace....

## Also update resource table?
## $column=$fieldinfo["resource_column"];
## if (strlen($column)>0)
## {
## if ($value=="") {$value="null";} else {$value="'" .
$value . "'";}
## sql_query("update resource set title= $value, file_path=$value
where ref='$resource' ");
## }

Tom Gleason

unread,
Nov 10, 2009, 10:52:18 AM11/10/09
to resour...@googlegroups.com
One more correction. sorry for not testing first. I had to add quotes
around the values here for that to work for me.

sql_query("update resource set title= '$value', file_path='$value'
where ref='$resource' ");

Tom Gleason

unread,
Nov 10, 2009, 10:55:55 AM11/10/09
to resour...@googlegroups.com
Oh jeez...what a mess. If you don't intend to change the filenames,
you'd also have to restrict the ability to edit the title field.
Otherwise this requires even further thought.

Tom Gleason

unread,
Nov 10, 2009, 11:02:41 AM11/10/09
to resour...@googlegroups.com
OK, I'm really sorry. Please ignore all the above, it's just wrong.

Kevin Relland

unread,
Nov 10, 2009, 11:10:39 AM11/10/09
to ResourceSpace
Cheers Tom, that is absolutely brilliant, there is one other thing
that i need help with.
i have turned off the strip profiles for the images, so when they
download they are correct, but the thumbnails and all the website
previews still strip the profile and they look really illuminous, do
you know how i can stop it from deleting the profile or stop the
colour being so different
Cheers
Kevin

On Nov 10, 4:02 pm, Tom Gleason <theorysav...@gmail.com> wrote:
> OK, I'm really sorry. Please ignore all the above, it's just wrong.
>
>
>
> On Tue, Nov 10, 2009 at 10:55 AM, Tom Gleason <theorysav...@gmail.com> wrote:
> > Oh jeez...what a mess. If you don't intend to change the filenames,
> > you'd also have to restrict the ability to edit the title field.
> > Otherwise this requires even further thought.
>

Tom Gleason

unread,
Nov 10, 2009, 11:15:31 AM11/10/09
to resour...@googlegroups.com
Really, hold up on that..It's completely incorrect.

Tom Gleason

unread,
Nov 10, 2009, 11:34:21 AM11/10/09
to resour...@googlegroups.com
At the very least, you need to conditionalize it to only do that for
the title field, assuming you've added $filename_field=8;

# hack:
if ($field==8){
sql_query("update resource set title = '$value',file_path='$value'
where ref='$resource'");
}

That totally relies on never editing the title field. Otherwise you'll
have to start looking at save_resource_data() and
save_resource_data_multi(), because edits to the title field will fall
back to the original resource_column mapping behavior, and your edits
won't be applied to both columns in the resource table.

Can you send me a sample of an image you're using? Not sure what you
mean with the profiles.

Kevin Relland

unread,
Nov 10, 2009, 2:46:52 PM11/10/09
to resour...@googlegroups.com
Hi Tom,
i won't need to edit the title field as we only ever store the images
under the original file name, but thanks anyway.
when the app uploads the image it strips out the icc profiles and
converts it to an RGB colorspace, the orignal file is fine when it
downloads but any preview image on the site is a very bright
conversion
Cheers
Kev

tom

unread,
Nov 10, 2009, 4:59:48 PM11/10/09
to ResourceSpace
Depends... if the correction can be universally made (i.e. if your
files are all similar and it is simply a matter of lightness) you may
be able to add some options to the imagemagick command in
image_processing.php (line 692 or so in create_previews_using_im() )

Jeff, who is an expert in the field, has laid out some color
management ideas for RS, and since my girlfriend is a professional
color manager, I really hope to get around to figuring out a workable
color-management solution for RS. Frankly, I've been in the business
of cosmetics and fashion ads for two years now, where color management
is *key*, and I just haven't quite grokked it yet. I've seen people
(the retouchers and printers) who are highly sensitive to color
changes, and I have noticed and fixed drastic color variations myself.
I have been getting by by finding various workarounds to make things
look pretty close (which may in the end be what it is all about...or
not), but haven't quite understood the *science* of color management
yet. I keep hoping for an epiphany...

Tom

On Nov 10, 2:46 pm, Kevin Relland <kevin.rell...@googlemail.com>
wrote:
> Hi Tom,
> i won't need to edit the title field as we only ever store the images
> under the original file name, but thanks anyway.
> when the app uploads the image it strips out the icc profiles and
> converts it to an RGB colorspace, the orignal file is fine when it
> downloads but any preview image on the site is a very bright
> conversion
> Cheers
> Kev
>
> On Tue, Nov 10, 2009 at 4:34 PM, Tom Gleason <theorysav...@gmail.com> wrote:
>
> > At the very least, you need to conditionalize it to only do that for
> > the title field, assuming you've added $filename_field=8;
>
> > # hack:
> >       if ($field==8){
> >                sql_query("update resource set title = '$value',file_path='$value'
> > where ref='$resource'");
> >                }
>
> > That totally relies on never editing the title field. Otherwise you'll
> > have to start looking at save_resource_data() and
> > save_resource_data_multi(), because edits to the title field will fall
> > back to the original resource_column mapping behavior, and your edits
> > won't be applied to both columns in the resource table.
>
> > Can you send me a sample of an image you're using? Not sure what you
> > mean with the profiles.
>

Kevin Relland

unread,
Nov 11, 2009, 3:52:08 AM11/11/09
to resour...@googlegroups.com
Hi Tom,
there are screen shots the website and then pic 4 is the downloaded
image which is correct, and if you convert this in photoshop the
colours stay the same.
Hope this helps
Cheers
Kevin
Picture 1.jpg
Picture 2.jpg
Picture 3.jpg
Picture 4.jpg

ccb

unread,
Dec 16, 2009, 10:58:09 AM12/16/09
to ResourceSpace
Sorry to revive this old thread.

I had a similar issue with wanting to use the Filename in the Title.
I discovered the "$filename_field=8;" option after 3000 resources had
already been uploaded without the title correctly populated. I ran a
command in MySQL on my development system and it put the data where I
needed it. Everything seems to be working correctly, but before I do
this to my production database I'd like to know if there is anything
else I am not considering

update resource set title=file_path where file_path is NOT NULL;

The "NOT NULL" is there because I had 237 items with NULL values in
the file_path. I had already manually edited the title of these
resources and did not want to redo them.

On Nov 10, 3:59 pm, tom <theorysav...@gmail.com> wrote:
> Depends... if the correction can be universally made (i.e. if your
> files are all similar and it is simply a matter of lightness) you may
> be able to add some options to the imagemagick command in
> image_processing.php (line 692 or so in create_previews_using_im() )
>
> Jeff, who is an expert in the field, has laid out some color
> management ideas for RS, and since my girlfriend is a professional
> color manager, I really hope to get around to figuring out a workable
> color-management solution for RS. Frankly, I've been in the business
> of cosmetics and fashion ads for two years now, where color management
> is *key*, and I just haven't quite grokked it yet. I've seen people
> (the retouchers and printers) who are highly sensitive to color
> changes, and I have noticed and fixed drastic color variations myself.
> I have been getting by by finding various workarounds to make things
> look pretty close (which may in the end be what it is all about...or
> not), but haven't quite understood the *science* of color management
> yet. I keep hoping for an epiphany...
>
> Tom
>
> On Nov 10, 2:46 pm, Kevin Relland <kevin.rell...@googlemail.com>
> wrote:
>
>
>
> > Hi Tom,
> > i won't need to edit thetitlefield as we only ever store the images
> > under the original file name, but thanks anyway.
> > when the app uploads the image it strips out the icc profiles and
> > converts it to an RGB colorspace, the orignal file is fine when it
> > downloads but any preview image on the site is a very bright
> > conversion
> > Cheers
> > Kev
>
> > On Tue, Nov 10, 2009 at 4:34 PM, Tom Gleason <theorysav...@gmail.com> wrote:
>
> > > At the very least, you need to conditionalize it to only do that for
> > > thetitlefield, assuming you've added $filename_field=8;
>
> > > # hack:
> > >       if ($field==8){
> > >                sql_query("update resource settitle= '$value',file_path='$value'
> > > where ref='$resource'");
> > >                }
>
> > > That totally relies on never editing thetitlefield. Otherwise you'll
> > > have to start looking at save_resource_data() and
> > > save_resource_data_multi(), because edits to thetitlefield will fall
> > >>>> >> sql_query("update resource settitle= '$value', file_path='$value'
> > >>>> >> where ref='$resource' ");

Thomas Spinnler

unread,
Apr 26, 2012, 4:56:35 AM4/26/12
to resour...@googlegroups.com
Hi There 

Where i must put this hack into?

# hack: 
> > >       if ($field==8){ 
> > >                sql_query("update resource settitle= '$value',file_path='$value' 
> > > where ref='$resource'"); 
> > >                } 

I have the same problem. I want to have the original filename as title.

Here is a example.
This is the original file 503926.jpg



When we uploaded that file, the tite is a generate of variable numbers and letters. Why? 
And Why is the Image so dark? Check the Screenshot please.




Our Wish is that we have the original File name in the titel and the normal color of the original file.
Is that possible?

Can anyone help us?

Thanks
Tom

 

Jonathan Markel

unread,
May 1, 2012, 11:46:17 AM5/1/12
to resour...@googlegroups.com
Thomas,
I think the hack you reference is no longer necessary on recent versions of RS.  The original file name should be captured in the database in Field51.  You can add:

# TITLE field that should be used as title on the View and Collections pages.
$view_title_field=51;

to your config.php. Once that is added the original file name should be used on all view pages as the title. You might consider adding:

# Use original filename when downloading a file?
$original_filenames_when_downloading=true;

as well so that downloaded files have the original file name as well.

The color issue is with how some versions of imagemagick are handling colorspace when rendering previews. See this thread:

https://groups.google.com/forum/?fromgroups#!topic/resourcespace/6GdYg0fFSjQ

You should just have to install the newest version of IM and then run update_previews.php to make the previews display properly

-Jon Markel

Thomas Spinnler

unread,
May 10, 2012, 1:54:45 AM5/10/12
to resour...@googlegroups.com
Ok now the titelname is correct. 

The next Problem is that i can't find the Pictures when i want to search. Just with the .jpg behind.

Thanks for help
Tom

Thomas Spinnler

unread,
May 10, 2012, 2:50:00 AM5/10/12
to resour...@googlegroups.com
In Field 51 i have the Exiftool_field Tags 
StrippedFilename

Here my config of the config.php

$view_title_field=51; 

# Use original filename when downloading a file
$original_filenames_when_downloading=true;
$prefix_resource_id_to_filename=false;


$thumbs_display_fields = array(51); 
$list_display_fields = array(51,73,71); 

Thanks for help
Tom

Thomas Spinnler

unread,
Oct 15, 2012, 2:04:29 AM10/15/12
to resour...@googlegroups.com
Can anyone help me about that

My Problem is that i can't find the Pictures when i want to search. Just with the .jpg behind.

Thanks Tom


Brian Schwenk

unread,
Oct 15, 2012, 8:24:44 AM10/15/12
to resour...@googlegroups.com
Using "StrippedFilename" in the exiftool field seems to be removing the jpg extension making it unsearchable. Try changing the exiftool field to "FILENAME." This should extract the entire filename including extension. Test it out with one photo, if that seems to work you will have to reindex the field using \pages\tools\reindex_field.php.

--
 
 

Thomas Spinnler

unread,
Oct 15, 2012, 8:52:35 AM10/15/12
to resour...@googlegroups.com
It doesn't work in the config.php file 

I have this for the right titlenames
$thumbs_display_fields = array(51); 
$list_display_fields = array(51,73,71); 

Can you help me when i give you the admin rights?
Can i send you a email with the rights?

Its very important 

Thanks
Tom

Brian Schwenk

unread,
Oct 15, 2012, 12:07:03 PM10/15/12
to resour...@googlegroups.com
I was talking about the system setup area. Here's a quick walkthrough of what i was talking about.

in team center go to system setup
Inline image 1

Open the original filename field
Inline image 2

Change the exiftool field to "FILENAME"
Inline image 3

Upload a sample image and try to search for it. If that works you will have to reindex the original file name field for the entire library by browsing to this address: (YourInstallation)/pages/tools/reindex_field.php?=51

Hope that helps!


--
 
 

image.jpeg
image.jpeg
image.jpeg

Thomas Spinnler

unread,
Oct 16, 2012, 1:37:56 AM10/16/12
to resour...@googlegroups.com
Thanks for your help and the Walktrouth

But it doesn't work. when i try the reindex address then i have this in my browser

Specify field with ?field=


in the the config.php file i have this commands:
Is here a mistake or have you got a command for the search?

$thumbs_display_fields = array(8,3);
$list_display_fields = array(8,3,12);
$sort_fields = array(12);
$prefix_resource_id_to_filename=false;
$prefix_filename_string="";
$view_title_field=51; 

# Use original filename when downloading a file
$original_filenames_when_downloading=true;
$prefix_resource_id_to_filename=false;


$thumbs_display_fields = array(51); 
$list_display_fields = array(51,73,71); 

$home_themes=false;
$use_theme_as_home=true;

Thanks for help
Tom

Thomas Spinnler

unread,
Oct 16, 2012, 3:12:24 AM10/16/12
to resour...@googlegroups.com
When we don't find e solution i have here a idea.

Where can i put .jpg in the search box?
Check my Screenshot.

Thanks for help
Tom



Allison Stec

unread,
Oct 16, 2012, 8:42:51 AM10/16/12
to resour...@googlegroups.com
Go bak to the original filename section within Team Center -> System Setup -> Resource Type/Fields and make sure Indexing is set to "yes". You may also want to consider turning partial indexing on, though there will be a bit of a performance penalty.

Once this is set you need to reindex as Brian described. It seems as if the message you received when trying this is suggesting you change the way you pass the field info in. See below:

address: (YourInstallation)/pages/tools/reindex_field.php?field=51



--
 
 

Brian Schwenk

unread,
Oct 16, 2012, 9:06:53 AM10/16/12
to resour...@googlegroups.com
Yea, my mistake. I wrote the address wrong. Thanks Allison. Definitely make sure indexing is turned on as well. 


--
 
 

Thomas Spinnler

unread,
Oct 16, 2012, 9:41:04 AM10/16/12
to resour...@googlegroups.com
No i have this error

Allison Stec

unread,
Oct 16, 2012, 11:16:55 AM10/16/12
to resour...@googlegroups.com
that's odd...when I run it the browser shows a button with the field name in it.

can you copy and paste the url you're using as well as include the rs version you're running?

--
 
 

Tom Gleason

unread,
Oct 22, 2012, 12:45:31 PM10/22/12
to resour...@googlegroups.com
You shouldn't map the filename field... the filename of the file in filestore is not the same as the original filename. The original filename should be stored automatically by default, and you should use other methods to show it in the web views. If you try to map the filename field, you may actually lose the original filename information by overwriting it with scrambled filenames from filestore.

The correct way to get filenames in the title is by changing the default $view_title_field to 51 and change search display fields to use 51 intstead of 8. (I think filename as title should be default since many files either don't have embedded titles, or the entry in the upload form Title field would be the same for all files). 

If a search for exact filename is not working, you should try:
$use_refine_searchstring=true; 

Which I added to fix several problems with search and makes the search more accurate.
Otherwise, the lack of keyword separation on the first attempt at searching does have this behavior of returning no results. If you click the search button again, does it return 'jpg' results? 

$use_refine_searchstring=true in my opinion should also be the default. 




--
 
 



--
Tom Gleason
Buildadam - ResourceSpace Hosting & Development

Colorhythm LLC
http://www.colorhythm.com

Main Office:  +1 415-399-9921
Fax: +1 253-399-9928
Mobile:  +1 347-537-8465

tgle...@colorhythm.com
Reply all
Reply to author
Forward
0 new messages