Tạo Gallery không sử dụng module Image

Events happening in the community are now at Drupal community events on www.drupal.org.
You are viewing a wiki page. You are welcome to join the group and then edit it. Be bold!

Dựa vào bài viết
- HOW TO: Create an image gallery using CCK and Views (not Image Module)
- Video drupalschool009.m4v

Các module cần thiết:

Sau đây là các bước thực hiện

1. Cấu hình trang web:

-Vào Administer->Site building->Modules:
a. Trong CCK chọn Content,Image
b. Trong Core chọn Upload.
c. Trong Other chọn Customer paper, Thickbox.
d. Trong Image chọn Imagecache.
e. Trong View chọn View,Bonus: grid view,Views UI.
- Sau khi tải và cài đặt các module trên,các bạn vào Administer->Logs->Status report: xem các lỗi của hệ thống, chúng ta sửa lỗi Clean URLs và Cron maintenance tasks.
- Đối với Cron maintenance tasks, bạn nhấn vào mục run cron manually.
- Đối với Clean URLs, nhấn vào Clean URLs. Nếu bạn hiểu rõ về Clean URLs thì nhấn vào Run the clean URL test, ngược lại bạn chọn handbook page on Clean URLs has additional troubleshooting information.
Ghi chú:
Ở chỗ này do mình xài WampServer nên mình vào Apache modules chọn rewrite_module.
Sau khi nhấn vào Run the clean URL test, chọn Enabled vào lưu lại.

2. Tạo Imagecache:

Các bạn vào Administer->Site configuration->Image cache.
a. Tạo squarethumbnail presets: với thông số sau
- scale: width:150,height:150,Scale to fit:Inside dimensions
- crop: width:75,height:75,X offset:center,Y offset:center

b. Tạo display presets: scale: width:650,height:650,Scale to fit:Inside dimensions

3. Tạo Content types image:

  • Các bạn vào Administer->Content management->Content types.
  • Chọn Add content types.Nhập Name: Image, type:image (Ghi chú: name và type bạn có thể nhập theo ý mình), rồi lưu.
  • Ta được content type là Image, chọn edit tại dòng Image.
  • Chọn tab Add field, nhập Name: image, chọn Image và lưu.Tại màn hình mới, bạn nhập tên thư mục vào Image path (Ghi chú: Tất cả hình ảnh khi up vào gallery sẽ lưu vào đây).

4. Tạo View:

  • Các bạn vào Administer->Site building->Views.
  • Chọn tab Add, nhập Name: Gallery và nhấn Save and edit.
  • Tại phần Page:
    a. Chọn Provide Page View.
    b. Nhập URL: gallery.
    c. Chọn Bonus: Grid View tại View Type.
    d. Nhập 24 vào Nodes per Page (Ghi chú:Số hình trên một trang).
  • Phần Fields: thêm Node:Title và Image: image (field_image)
    a. trên Image: image (field_image) chọn Handler: Do not group multiple values Option: Thickbox: squarethumbnail
  • Phần Filters: Thêm
    a. Node Published = Yes.
    b. Node Type 'is one of' Image

5. Hoàn tất

Tới đây mọi thứ đã chuẩn bị xong, bạn vào Create content->Image để upload hình ảnh lên. Để xem thành quả của mình, bạn nhập [yourdomain]/gallery tại thanh address.

Còn phần tạo nhiều Gallery thì mình chưa biết hix hix