Feature Request: Suggestions to improve the CssSpriteGen

Bug #474332 reported by Patrik Grinsvall
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
CSS Sprite Generator
Wishlist
Unassigned

Bug Description

Hi!

I'm using the CssSpriteGen class in my projects for automatic sprite generation of assets. With assets i mean images uploaded through my CMS.
However, in order to get this to work i have been hacking quite alot in the CssSpriteGen class.

These are the suggestions i have though to improve the CssSpriteGen class and make it more usable in other applications.

* Reduce the cyclic complexity. I've counted it to 27 in the CssSpriteGen class.
* Separate the main CssSpriteGen from the rest of the application, eg. $this->aFormValues. The ideal scenario would be to have two different applications, one for the web upload and one for the Sprite generation itself.
* Provide a method called something like, AddImageToSprite($filename), so it can be used from CMSs. Then generate sprites from that private accessible list of files. In that way the CssSpriteGen class can be used by many different applications.
* Split out code from the large methods in the CssSpriteGen class. The CreateSprite Method is 435 lines long.
* Either code an Option class or provide methods for setting sprite options.
* Have proper PhpDoc blocks for all methods and provide an Api Reference.
* Create classes for unit tests. Unit tests are neccissary in order to auto generate sprites in a production environment, but this one is on the wishlist.

Best Regards

Patrik

Revision history for this message
Ed Eliot (ejeliot) wrote : Re: [Bug 474332] [NEW] Feature Request: Suggestions to improve the CssSpriteGen

Hi Patrick,

All good points. Most of these are already on our list of things to look
at - we have a number of ideas for re-using the class ourselves which
requires many of these changes. If you've made any changes as a result of
your integration that you'd like to feed back please let me know and I'll
update the main code base accordingly.

Regards,

Ed

> Public bug reported:
>
> Hi!
>
> I'm using the CssSpriteGen class in my projects for automatic sprite
> generation of assets. With assets i mean images uploaded through my CMS.
> However, in order to get this to work i have been hacking quite alot in
> the CssSpriteGen class.
>
> These are the suggestions i have though to improve the CssSpriteGen
> class and make it more usable in other applications.
>
> * Reduce the cyclic complexity. I've counted it to 27 in the CssSpriteGen
> class.
> * Separate the main CssSpriteGen from the rest of the application, eg.
> $this->aFormValues. The ideal scenario would be to have two different
> applications, one for the web upload and one for the Sprite generation
> itself.
> * Provide a method called something like, AddImageToSprite($filename), so
> it can be used from CMSs. Then generate sprites from that private
> accessible list of files. In that way the CssSpriteGen class can be used
> by many different applications.
> * Split out code from the large methods in the CssSpriteGen class. The
> CreateSprite Method is 435 lines long.
> * Either code an Option class or provide methods for setting sprite
> options.
> * Have proper PhpDoc blocks for all methods and provide an Api Reference.
> * Create classes for unit tests. Unit tests are neccissary in order to
> auto generate sprites in a production environment, but this one is on the
> wishlist.
>
> Best Regards
>
> Patrik
>
> ** Affects: css-sprite-generator
> Importance: Undecided
> Status: New
>
> --
> Feature Request: Suggestions to improve the CssSpriteGen
> https://bugs.launchpad.net/bugs/474332
> You received this bug notification because you are a member of Project
> Fondue, which is subscribed to CSS Sprite Generator.
>

Changed in css-sprite-generator:
status: New → Triaged
importance: Undecided → Wishlist
Revision history for this message
Patrik Grinsvall (patrik-grinsvall) wrote : Re: [Bug 474332] Re: Feature Request: Suggestions to improve the CssSpriteGen

Hi,

I acctually did a wrapper class which allowed dynamic sprite generation
based on uploaded images from a CMS. This was however for a customer and i
dont have permission to share it.

I would however love to contribute a couple of lines of code when i have
time.

// Patrik

2010/7/10 Stuart Colville <email address hidden>

> ** Changed in: css-sprite-generator
> Status: New => Triaged
>
> ** Changed in: css-sprite-generator
> Importance: Undecided => Wishlist
>
> --
> Feature Request: Suggestions to improve the CssSpriteGen
> https://bugs.launchpad.net/bugs/474332
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in CSS Sprite Generator: Triaged
>
> Bug description:
> Hi!
>
> I'm using the CssSpriteGen class in my projects for automatic sprite
> generation of assets. With assets i mean images uploaded through my CMS.
> However, in order to get this to work i have been hacking quite alot in the
> CssSpriteGen class.
>
> These are the suggestions i have though to improve the CssSpriteGen class
> and make it more usable in other applications.
>
> * Reduce the cyclic complexity. I've counted it to 27 in the CssSpriteGen
> class.
> * Separate the main CssSpriteGen from the rest of the application, eg.
> $this->aFormValues. The ideal scenario would be to have two different
> applications, one for the web upload and one for the Sprite generation
> itself.
> * Provide a method called something like, AddImageToSprite($filename), so
> it can be used from CMSs. Then generate sprites from that private accessible
> list of files. In that way the CssSpriteGen class can be used by many
> different applications.
> * Split out code from the large methods in the CssSpriteGen class. The
> CreateSprite Method is 435 lines long.
> * Either code an Option class or provide methods for setting sprite
> options.
> * Have proper PhpDoc blocks for all methods and provide an Api Reference.
> * Create classes for unit tests. Unit tests are neccissary in order to auto
> generate sprites in a production environment, but this one is on the
> wishlist.
>
> Best Regards
>
> Patrik
>
> To unsubscribe from this bug, go to:
> https://bugs.launchpad.net/css-sprite-generator/+bug/474332/+subscribe
>

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers