[PLIP-Advisories] Re: [Plone] #9186: Set Image IDs from Title field

plip-advisories at lists.plone.org plip-advisories at lists.plone.org
Mon Aug 17 15:35:35 UTC 2009


#9186: Set Image IDs from Title field
------------------------+---------------------------------------------------
 Reporter:  erikrose    |        Owner:  erikrose
     Type:  PLIP        |       Status:  reopened
 Priority:  minor       |    Milestone:  4.0     
Component:  Archetypes  |   Resolution:          
 Keywords:              |  
------------------------+---------------------------------------------------

Old description:

> '''Proposed by:''' Erik Rose[[BR]]
> '''Seconded by:''' (Step right up!)
>
> == The Problem ==
> The Image type chooses the IDs of new objects differently than other
> types: rather than transforming the Title ("My Dog Watches Me Eat"
> becoming "my-dog-watches-me-eat"), they use the name of the uploaded
> file. This has several disadvantages:
>
>  1. Inconsistency with other types. 8.5 (yes, there was a half) out of 14
> of our Plone user's group attendees today find the current behavior
> surprising or counterproductive. Only 1 actively prefers the current
> behavior. The rest don't see any problem in changing it.
>  1. Many common use cases involve images whose filenames are
> autogenerated and uninformative. All these cases result in URLs like
> `Picture%201.PNG`, which are uninformative, subjectively funny looking,
> and hard to remediate without first renaming and then re-uploading a
> large file:
>    * Screenshots on a Mac come with titles like `Picture 1` and, because
> their lifetimes on disk are typically short, aren't often renamed.
>    * Pictures from cameras look like `P1090404.JPG`.
>    * Flickr images look like `3425573738_90e84302e8.jpg`.
>  1. When screenshots are routinely uploaded to the same folder (say, a
> site-wide `images` folder), everybody but the first uploader of `Picture
> 1.png` is met with an error—"There is already an item named Picture 1.png
> in this folder."—and has to do a context switch back to another app to
> rename the file (which, if the user had good reason to name the local
> file "Picture 1", is pretty intrusive).
>  1. The case of image extensions differs depending on platform. Windows
> tends to use capital `.JPG`; Mac, `.jpg`. Such inconsistency makes URLs
> hard to guess.
>  1. There's no other way in Plone, short of manually enabling short-name
> editing, to end up with capital letters in URLs.
>
> == The Proposal ==
>  * Have Images choose their IDs based on entered Titles, as with other
> types.
>  * The Title field remains unrequired, thus maintaining happiness with
> uploads via WebDAV or FTP, which don't provide opportunity to enter a
> title. Choosing an image file should stick its name in the Title field
> via JS if that field was empty, thus effectively providing the current
> behavior as an option as well as showing the user what's about to happen.
>  * On creation form submission, the object's ID is assigned as follows:
>    * If the Title field is the same as the name of the uploaded file, the
> ID is the contents of the Title field, without going through the typical
> Title-field-normalization filter. This maintains the current behavior as
> an option.
>    * If the Title field is different than the name of the uploaded file,
> the ID is the normal munged Title field contents.
>  * ~~If browsers are awful and require file extensions in URLs~~ (which
> they don't), ~~compute them from the uploaded MIME type using the
> existing `guess_content_type()` machinery or something. This solves the
> inconsistency where some files say `.jpg`, others `.jpeg`, and still
> others `.JPG`.~~
>
> == Addendum: the File type ==
> P.S. Though this PLIP shouldn't succeed or fail based on this, we might
> also consider making a similar change to the behavior of the File type.

New description:

 '''Proposed by:''' Erik Rose[[BR]]
 '''Seconded by:''' (Step right up!)

 == The Problem ==
 The Image type chooses the IDs of new objects differently than other
 types: rather than transforming the Title ("My Dog Watches Me Eat"
 becoming "my-dog-watches-me-eat"), they use the name of the uploaded file.
 This has several disadvantages:

  1. Inconsistency with other types. 8.5 (yes, there was a half) out of 14
 of our Plone user's group attendees today find the current behavior
 surprising or counterproductive. Only 1 actively prefers the current
 behavior. The rest don't see any problem in changing it.
  1. Many common use cases involve images whose filenames are autogenerated
 and uninformative. All these cases result in URLs like `Picture%201.PNG`,
 which are uninformative, subjectively funny looking, and hard to remediate
 without first renaming and then re-uploading a large file:
    * Screenshots on a Mac come with titles like `Picture 1` and, because
 their lifetimes on disk are typically short, aren't often renamed.
    * Pictures from cameras look like `P1090404.JPG`.
    * Flickr images look like `3425573738_90e84302e8.jpg`.
  1. When screenshots are routinely uploaded to the same folder (say, a
 site-wide `images` folder), everybody but the first uploader of `Picture
 1.png` is met with an error—"There is already an item named Picture 1.png
 in this folder."—and has to do a context switch back to another app to
 rename the file (which, if the user had good reason to name the local file
 "Picture 1", is pretty intrusive).
  1. The case of image extensions differs depending on platform. Windows
 tends to use capital `.JPG`; Mac, `.jpg`. Such inconsistency makes URLs
 hard to guess.
  1. There's no other way in Plone, short of manually enabling short-name
 editing, to end up with capital letters in URLs.

 == The Proposal ==
  * Have Images choose their IDs based on entered Titles, as with other
 types.
  * The Title field remains unrequired, thus maintaining happiness with
 uploads via WebDAV or FTP, which don't provide opportunity to enter a
 title.
  * On creation form submission, the object's ID is assigned as follows:
    * If the Title field is the same as the name of the uploaded file, the
 ID is the contents of the Title field, without going through the typical
 Title-field-normalization filter. This maintains the current behavior as
 an option.
    * If the Title field is different than the name of the uploaded file,
 the ID is the normal munged Title field contents.
  * ~~If browsers are awful and require file extensions in URLs~~ (which
 they don't), ~~compute them from the uploaded MIME type using the existing
 `guess_content_type()` machinery or something. This solves the
 inconsistency where some files say `.jpg`, others `.jpeg`, and still
 others `.JPG`.~~

 == Addendum: the File type ==
 P.S. Though this PLIP shouldn't succeed or fail based on this, we might
 also consider making a similar change to the behavior of the File type. As
 of the first closing of this ticket, the File type has not been changed.

--

Comment(by erikrose):

 Removed reference to JS, which was a bad UI idea.

-- 
Ticket URL: <http://dev.plone.org/plone/ticket/9186#comment:40>
Plone <http://plone.org>
Plone Content Management System


More information about the PLIP-Advisories mailing list