Normalize Filename during upload ?

Author Message

H-Works Agency

Friday 23 March 2007 12:31:43 pm

Hi all,

I have always the same problems with my clients, telling them to check their filename before uploading.

Like removing accents, spaces well using [0-9]+[a-z]+[A-Z]+[_-]

But like always most of them don't even think about it resulting in a chaotic file organisation.

Is there a way to tell EZP to normalize file names during storage ? WOuld be the same type of transformation used from $node.name to $url_alias.

That would transform this "my filé is à la maison.jpg" into "my_file_is_a_la_maison.jpg".

Being able to enable this transformation from an upload.ini directive would be great but i am shure this should already exist.

Thanx a lot in advance

EZP is Great

Michael Maclean

Tuesday 27 March 2007 3:50:00 am

Hi, I'm not sure if this will work, but you might be able to use a custom edit handler for it:
http://serwatka.net/en/blog/ez_publish_3_8_new_custom_edit_handler

I have something similar in mind, and this is how I'm hoping to do it (though I have other things to do first, otherwise I'd show you the code).

eZpedia community documentation project | http://ezpedia.org

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 14:56:48
Script start
Timing: Jan 18 2025 14:56:48
Module start 'layout'
Timing: Jan 18 2025 14:56:48
Module start 'content'
Timing: Jan 18 2025 14:56:50
Module end 'content'
Timing: Jan 18 2025 14:56:50
Script end

Main resources:

Total runtime1.3980 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0083 587.9141152.6250
Module start 'layout' 0.00830.0050 740.539139.4453
Module start 'content' 0.01331.3833 779.9844519.6719
Module end 'content' 1.39660.0014 1,299.65638.1563
Script end 1.3979  1,307.8125 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00370.2618160.0002
Check MTime0.00150.1060160.0001
Mysql Total
Database connection0.00200.146610.0020
Mysqli_queries1.348096.4236540.0250
Looping result0.00060.0452520.0000
Template Total1.348296.420.6741
Template load0.00200.140720.0010
Template processing1.346296.300320.6731
Template load and register function0.00010.007310.0001
states
state_id_array0.00140.099710.0014
state_identifier_array0.00230.164620.0012
Override
Cache load0.00160.1134160.0001
Sytem overhead
Fetch class attribute can translate value0.00090.062120.0004
Fetch class attribute name0.00140.101030.0005
XML
Image XML parsing0.00130.095620.0007
class_abstraction
Instantiating content class attribute0.00000.000530.0000
General
dbfile0.00140.1014170.0001
String conversion0.00000.002040.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
2content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 8
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs