Django-dynamic-sprites.

ÀÀ¿ë ÇÁ·Î±×·¥ »ç¿ëÀÚ°¡ »ý¼º ÇÑ °´Ã¼¸¦ ±â¹ÝÀ¸·Î ½ºÇÁ¶óÀÌÆ®¸¦ »ý¼ºÇÏ´Â ¹æ¹ý
Áö±Ý ´Ù¿î·Îµå

Django-dynamic-sprites. ¼øÀ§ ¹× ¿ä¾à

±¤°í

  • Rating:
  • ƯÇã:
  • BSD License
  • °¡°Ý:
  • FREE
  • °Ô½ÃÀÚ À̸§:
  • Vinicius Mendes
  • °Ô½ÃÀÚ À¥»çÀÌÆ®:
  • http://github.com/vbmendes/

Django-dynamic-sprites. ű×


Django-dynamic-sprites. ¼³¸í

Django-dynamic-sprites´Â ÆÄÀ̽ã°ú django¿¡ ´ëÇÑ ½ºÇÁ¶óÀÌÆ®¸¦ µ¿ÀûÀ¸·Î ¸¸µé ¼öÀÖ´Â Django ¾ÛÀÔ´Ï´Ù. PIP¸¦ ÅëÇØ ÆÐÅ°Áö¸¦ »ç¿ëÇÏ¿© ÆÐÅ°Áö¸¦ ¸¸µå´Â µ¥ ÀÖ½À´Ï´Ù. PIP ¼³Ä¡ Æú´õÀÇ ¸ðµç ±×¸²¿¡¼­ Æú´õÀÇ ¸ðµç ±×¸²¿¡¼­ À̹ÌÁö¿¡ Django-dynamic-spritesegenerating sprite¸¦ ¼³Ä¡ÇÕ´Ï´Ù. ÀÌ·¸°ÔÇÏ·Á¸é ´ÙÀ½ ¸í·ÉÀ» ÀÔ·ÂÇϽʽÿÀ. generate_sprites.py path / to / Æú´õ °æ·Î / to / opperone to-to-to in notions Ãâ·Â È®ÀåÀÚ°¡ Àü´ÞµÇÁö ¾Ê½À´Ï´Ù. ½ºÅ©¸³Æ®´Â ÀÌ¹Ì .png¿Í CSS¸¦ °¡Áø À̹ÌÁö¸¦ ÀÌ¹Ì »ý¼ºÇÕ´Ï´Ù. Python CodewinThin CodeWithin¿¡¼­ Sprite¿¡¼­ Sprite¸¦ »ç¿ëÇÏ¿© ÁÖ¾îÁø À̹ÌÁö ¼¼Æ®¿¡ ´ëÇÑ ½ºÇÁ¶óÀÌÆ®¸¦ »ý¼º ÇÒ ¼ö ÀÖ½À´Ï´Ù. ´ç½ÅÀÌÇØ¾ß ÇÒ ÀÏÀº À̹ÌÁö °æ·Î, °¢ À̹ÌÁö¿¡ nomeÀ» Á¦°øÇÏ°í, sprite¸¦ »ý¼ºÇÏ°í sprite_sprites.sprite import spriteImage = (( 'ºê¶óÁú', '/ path/to/brazil/image.png') , ( 'USA', '/ path/to/usa/image.png'), sprite = sprite ('sprite_name ', À̹ÌÁö) OUTPUT_IMAGE = SPRITE.GENERATE () OUTPUT_IMAGE.SAVE ('/ PATH / to / OUTPUT / Image.png ') output_css = sprite.generate_css ('http://images.com/houtput/image.png ') output_css.save ('/path/to/output/style.css)¸¦ »ý¼ºÇÏ´Â ±âº» »çÇ×ÀÔ´Ï´Ù. ÆÄÀ̽ã Äڵ忡¼­ ½ºÇÁ¶óÀÌÆ®. ±×·¯³ª Django¿Í ±×°ÍÀ» ÅëÇÕÇÏ´Â Ãß»óÈ­°¡ ÀÖ½À´Ï´Ù. Django¸¦ °®´Â ÇÁ·ÎÁ§Æ®ÀÇ À̸§Á¶Â÷µµ Django Queryset OppersletÀÇ Ã´À» »ç¿ëÇÏ´Â Django.Generating Sprite¸¦ »ç¿ëÇÏÁö ¾Ê°í ½ºÇÁ¶óÀÌÆ®¸¦ »ý¼º ÇÒ ¼ö ÀÖ½À´Ï´Ù. ÀÌ¿Í °°Àº Django ¸ðµ¨ÀÇ Ã´ : Django.db °¡Á® ¿À±â ¸ðµ¨ Ŭ·¡½º ±¹°¡ (Models.Model) : name = models.charfield (max_length = 255) slug = models.slugfield () Ç÷¡±× = models.ImageField (upload_to = '±¹°¡')¿Í ¸ðµç ±¹°¡ Ç÷¡±×°¡ÀÖ´Â ½ºÇÁ¶óÀÌÆ®¸¦ ¿øÇÕ´Ï´Ù. Sprite Specifization ( 'Country-Flags', QuerySet = Country.Objects.All (), image_field = 'slug_field ='sprite 'output_image = Sprite¸¦ »ç¿ëÇÏ¿© Sprite ('Country-Flags ', queryset = Country.Objects.All (), slug_imfield = sprite) »ý¼º () OUTPUT_IMAGE.SAVE ( '/ path / to / output / image.png') OUTPUT_CSS = SPRITE.GENATER_CSS ( 'http://images.com/houtput/image.png') output_css.save ( '/ path / to / outtput / style.css ') ¶ÇÇÑ post_save listener¿¡ sprite »ý¼ºÀ» ¿¬°áÇÏ°í querysetÀÇ °³Ã¼°¡ ÀúÀå µÉ ¶§¸¶´Ù sprite¸¦ ´Ù½Ã »ý¼º ÇÒ ¼ö ÀÖ½À´Ï´Ù. django.db.models.signals °¡Á® ¿À±â post_savefrom dynamic_sprites.listeners °¡Á® ¿À±â modelspriteListenerListener = modelspriteListener ( 'Country-Flags', Image_Field = 'Ç÷¡±×', slug_field = 'slug', queryset = Country.Objects.All ()) post_save.connect (listener, sender = ±¹°¡) projectÀÌ ÇÁ·ÎÁ§Æ®¿¡ ±â¿©ÇÏ´Â °ÍÀº ¿ÀÇ ¼Ò½ºÀÔ´Ï´Ù. , ±âºÎ±ÝÀº ȯ¿µÇÕ´Ï´Ù. Á¦Ç°ÀÇ È¨ÆäÀÌÁö


Django-dynamic-sprites. °ü·Ã ¼ÒÇÁÆ®¿þ¾î