Drupal 6. Primitive Gallery CCK + ImageField + ImageCache + Lightbox2

    This is a small article (or manual, if you like) about creating a primitive gallery through additional modules. Sam undertook the study of Drupal three days ago. I have to say that after WordPress it’s a bit complicated, but it’s possible to understand and understand. Go.

    First of all, thanks to all the people who helped write not to my blog. Thank you so much!

    If you do not have Drupal installed (drupal-6.8), download the system from Drupal.org and download the following modules in parallel:
    CKK, FileField, Lightbox2 dev (required version for developers!), ImageAPI, ImageField, ImageCache. I hope you do not need to explain that these modules need to be copied to / sites / all / modules / and enabled (you can see the dependencies on the page with modules).

    Go to the Administer / Site Building / Modules, turn it on
    In the CCK block:
    Content, Content Permissions, FileField, ImageField, Text
    In the Optional Core block:
    PHP Filter
    In the ImageCache:
    ImageAPI, ImageAPI, GD2, ImageCache, ImageCache UI
    block In the Other:
    Lightbox2 block
    After switching on the modules, go to Administer / Site Building / ImageCache and click on Add new preset.
    In the text field of the Preset namespace form, enter img_120x120, then save: Create New Preset. On the page that opens, select an action to process the photo. I chose Add Scale (this is a scaling with proportions), after choosing an action on the page, we select our size - width: 120, height 120. Click Add Action, the preset is ready.

    how it should turn out: Go to Administer / Site configuration / Lightbox2.


    General tab:
    Put the birds on the Force visibility of navigation links and on Continuous galeries
    HTML Content tab:
    Set your size to a large photo or leave it as default (600x400)
    Automatic image handling
    Image node settings:
    Automatic handler for image nodes tab change to Lightbox grouped
    Inline images
    Automatic handler for inline images change to Lightbox grouped
    Save (Save configuration)

    Go to Administer / Content types and select from the manage field operations next to the Story item. Add a new field:
    Label: imgsrc
    Field name imgsrc
    Select a field type: image
    We were redirected to the field page. We leave everything as default. Besides:
    File path: this is the path inside the files directory where the downloaded images will be copied, you can put imgsrc. Number of values ​​- the number of fields for uploading photos - set Unlimited. Save (Save filed settings).

    how it should turn out: Go to Display fields. In Teaser we change the value of Generic Files to Lightbox2: img_120x120-> original In the Full node we change the value of Generic Files to Lightbox2: img_120x120-> original how it should turn out: Now create a material like Story Create content-> Story Title: Test gallery 01 Body: you can not fill block imgsrc

    Display fields

    New upload, select files (by default, two fields for upload, but you can click add another item and make them as many as you like). After choosing a photo, click Upload (on each photo). The settings below can not be touched. Next is the Save button. That's all. It remains to make small changes to display thumbnails.
    Go to Administer / Site building / Blocks and create a new block.
    Block Description: Gallery CSS
    Block title: Block body: Input format: PHP code Save (Save block). The region for the created block, we select Header as it should turn out: Now we will make a css-file with the following data: That's all, pick your settings: you can do anything. Good luck UPD

    div.odd, div.even {float: left; margin-right: 5px; }
    div.field-label {display: none; }

    Thanks a lot to ivlis for the live preview .

    Also popular now: