Page 1 of 1

Remove first 3 digits in img title. I have the code to do so

Posted: 12 Mar 2010, 18:15
by siddan
Hello

This is just a small thing to improve image sorting, for me at least....
I have all my image file names beginning with 001 firstpic.jpg, 002 secondpic, 003 thirdpic etc. This way I can have total control of sorting my images and then have a good overview of the order when uploading them to phoca.

I have a useful php snippet which will remove the first 3 digits , if there are any.
Allthough I have used this on the title name below the thumbnail and in the Highslide JS image header, I came to realize that I must have this php snippet pasted just before all output generated titles. And that would be quite a few.

So instead I try the luck in asking where I can paste this php snippet in one place so it applies on all $value->title variables?

This is the snippet in question

Code: Select all

// Remove first 3 digits of title name, if any
		$value->title = preg_replace(
		   array('/^[0-9]{1,3}/', '/_/'),
		   array('', ' '), $value->title
		);

Re: Remove first 3 digits in img title. I have the code to d

Posted: 15 Mar 2010, 23:14
by Jan
Hi, thank you for this info.

Jan