欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

点击图片的时候 不是打开新页面 而是下载 当然是所有文件都可以用这种方法下载

shiping1 的头像
1)我的思路就是在
在google 中 搜 drupal download image 自动出现  drupal download image link
2)发现有个模块 DownloadFile  https://drupal.org/project/download_file
3)下载 安装 启用它
4)看它的readme.txt
照着它做 最后有了效果后 找它的下载链接url  <a href="/download/file/fid/236">b253719cd3c04f39cb9b2ee11fa6ac85.jpg</a>
就明白是怎么回事了

readme.txt 如下
// $Id: README.txt,v 1.2.2.3 2010/10/08 07:15:58 xmattx Exp $

-- SUMMARY --

DownloadFile is a module to direct download files or images.

For a full description of the module, visit the project page:
  http://drupal.org/project/download_file

To submit bug reports and feature suggestions, or to track changes:
  http://drupal.org/project/issues/download_file

-- REQUIREMENTS --

 * FileField

-- INSTALLATION --

1) Copy the download_file folder to the modules folder in your installation.
(下载 安装)

2) Enable the module using Administer -> Site building -> Modules
   (/admin/build/modules).
(启用)
3) Configure user permissions in Administer -> User management -> Permissions ->
   download_file module and "access direct download file".
(配置权限)
4) Manage teaser and full node display settings at Administer -> Content
   -> Content types -> "your type" -> Manage fields
   (/admin/content/node-type/"your type"/fields)
   and click on the tab Display fields
   (/admin/content/node-type/"your type"/display).
(设置哪个字段可以下载)
5) Choose a formatter to apply to files or images in that field. Four new
   formatters "Direct download file" appear in the select list.
(设置哪个字段可以下载)   (到前台看看是什么样子的,下载链接是什么样子的)
6) Configure the format of the link accessible at Administer -> Site
   configuration -> Download file (/admin/settings/download-file).
(配置链接的格式,没看懂好像作用不大)
Using with Views module
-----------------------
Similarly, you can use a formatter when displaying files or images attached to
nodes using FileField or ImageField in a View (http://drupal.org/project/views)
through the Views UI.

1) Manage display at Administer -> Site building -> Views (/admin/build/views)
   and add a new view by clicking the "Add new view" tab (/admin/build/views/add)
   or edit an existing view by clicking the "Edit" link
   (/admin/build/views/edit/"your view").

2) Click on a file field or image field.

3) Choose a formatter in select list "Format" to apply at this field. Four new
   formatters "Direct download file" appear.

4) Click on "Save" button and see the display in the preview.

-- CONTACT --

Current maintainer:
* Matthieu Moratille (xMATTx) - http://drupal.org/user/394628

This project has been sponsored by:
* CORE-TECHS
  An innovative company based in Paris whose activities are structured around
  the software production, service delivery and use of open source technologies.
  Visit http://www.core-techs.fr for more information.
普通分类: