Gallery: 图片尺寸设定:修订间差异

来自站长百科
跳转至: 导航、​ 搜索
→‎介绍
第28行: 第28行:
* 如果需要的话,你可以为每个相册设置'''不同的缩略图和重设图片尺寸'''。只要浏览一个相册并点击''编辑相册(Edit Album)''就可以了。
* 如果需要的话,你可以为每个相册设置'''不同的缩略图和重设图片尺寸'''。只要浏览一个相册并点击''编辑相册(Edit Album)''就可以了。
* 在G2中,你的图片'''没有上采样过程(upsampling)''',即,如果重设的尺寸比原图片大的话,就不会进行此创建动作。而缩略图的尺寸如果大于原始图片的尺寸的话,原始图片就会被当作缩略图使用。
* 在G2中,你的图片'''没有上采样过程(upsampling)''',即,如果重设的尺寸比原图片大的话,就不会进行此创建动作。而缩略图的尺寸如果大于原始图片的尺寸的话,原始图片就会被当作缩略图使用。
* '''新建相册的设定'''继承父族相册的设定。因此,如果你希望新建的顶层相册具有希望看到的缩略图和重设图片尺寸的话,就需要在[[Gallery:Root_Album|根目录相册]]中设置尺寸。
* '''新建相册的设定'''继承父族相册的设定。因此,如果你希望新建的顶层相册具有期望中缩略图和重设图片尺寸的话,就需要在[[Gallery:Root_Album|根目录相册]]中设置尺寸。


=== Thumbnail Size ===
=== Thumbnail Size ===

2008年7月22日 (二) 16:20的版本

图片尺寸设定

此文介绍Gallery2中不同图片版式的各种类型,以及管理它们的方法。

介绍

Gallery2 (G2)显示上传至网站的图片。另外,G2为所有上传的图片生成小些的预览图片,我们称之为“缩略图(thumbnail)”。如果你没有对外观主题设定进行改变,G2就会在一个预览页面(相册页面)中显示9个缩略图。

如果你点击某个缩略图,G2就会为你显示一个较大的图片,并且带有图片的名称,描述及其他细节信息。如果你没有对设定做修改,你就会看到一个缩小尺寸/中等尺寸的图片,我们称之为重设尺寸的图片重设的图片(resize)。你可以配置不限数量的此类图片,并且某图片可用版式均列在(相片)页面的右上角。

在右上角你可以看见一个原尺寸图片的链接。即上传到Gallery2的图片的原始大小。

如果原始图片的格式不是web可见类型(tiff,wmf,tga...)的话,你就会在原始图片下方看见一个下载(download)链接。在这种情况下,原始尺寸的图片就是web可见的了(JPEG格式),并且与之前web不可见类型的图片具有相同的规格尺寸。

注意,你所看到及点击缩略图所产生的行为取决于你所使用的外观主题。在此我们介绍一下默认外观主题(matrix)下的行为。

要求

Gallery2仅当至少一个图片工具组件(imagemagick,netpbm,gd...)活动时才会生成缩略图和重设图片。

并非所有的的图片工具都能胜任所有格式的图片处理。ImageMagick支持的图片格式算是最多的了。它甚至可以生成PDF文件的缩略图和重设图片,尤其是图像等。

注意你的imagemagick/gd/netpbm不一定支持G2所罗列出的全部文件类型。这取决于imagemagick/netpbm二进制或gd library/php的编译方式。

参见:支持的MIME类型获取Gallery2支持的文件类型一览表。

设置图片尺寸

就站内的默认设定,可以浏览根目录相册点击编辑相册(Edit Album)并点击相册(Album)标签。

注意:

  • 如果需要的话,你可以为每个相册设置不同的缩略图和重设图片尺寸。只要浏览一个相册并点击编辑相册(Edit Album)就可以了。
  • 在G2中,你的图片没有上采样过程(upsampling),即,如果重设的尺寸比原图片大的话,就不会进行此创建动作。而缩略图的尺寸如果大于原始图片的尺寸的话,原始图片就会被当作缩略图使用。
  • 新建相册的设定继承父族相册的设定。因此,如果你希望新建的顶层相册具有期望中缩略图和重设图片尺寸的话,就需要在根目录相册中设置尺寸。

Thumbnail Size

  • You can set the maximal size in pixels for thumbnails.

The aspect ratio of the generated thumbnail will be the same as the one of the original full-size image. If your original image has the ratio 4:3 of width to height and you chose 160 as the thumbnail size, then your thumbnail will have the dimensions 160 pixel in width and 120 pixel in height.

If the squarethumb module is active, all thumbnails will be generated with square dimensions, that is their width is the same as their height, independently of the aspect ratio of the original.

Notes:

  • You can set a cropped thumbnail manually for each photo by browsing to a photo and clicking on Edit Photo and then on the Crop Thumbnail tab.
  • You can upload an unrelated / specific image as thumbnail for any item. Activate the thumbnail module and browse to the album / photo and click on Edit Album / Edit Photo and then on the General tab to use the custom thumbnail upload option at the bottom of the page.
  • Thumbnails for albums are called highlight or album highlight since this single thumbnail represents all photos of this album.
  • G2 picks the first image that was added to an album as the album highlight. You can change the album highlight by browsing to a photo of the album and clicking Make Highlight.
  • If you want that the thumbnail for an album changes randomly to showcase all the photos of the album as album highlight, activate the randomhighlight module for that album.

Resize Size

  • You can set the maximal dimensions in pixels for each resize. The [ ] x [ ] input fields are for width (left box) and height (right box) of the resize.
  • You can set an arbitrary number of intermediate sized images by entering dimensions.
  • You can set the priority / order of the resizes. The resize dimensions at the top of the list are shown as the default resize etc. The order in which you list the dimensions in edit album -> 'album' is the order in which the resize versions are listed in the resize list shown of on each photo page.

The aspect ratio of the generated thumbnail will be the same as the one of the original full-size image. The dimensions you enter for the resize version are maximums in pixels for the width and the height.

Notes:

  • Different resize sizes for each photo in an album are also possible. Browse to a photo and click Edit Photo and then on the Photo tab.

Full-Size Size

The dimensions of the original full-size image are unchanged unless you explicitly change them. If you deal with 8 MegaPixel images from your latest digital camera, you might want to resize (down size/down sample) the images before you upload them to G2 to save bandwidth and webspace.

Notes:

  • Gallery Remote can resize the images on upload for you
  • G2 can resize your original files automatically for you when you add them if the sizelimit module is active and a sizelimit is defined for the album in Edit Album in the Album tab. The original file will be resized and and the resized version will be stored as the new original and the old original will be deleted.
  • You can resize images in G2 manually by browsing to a photo and clicking on Edit Photo, then on the Modify Photo tab.

Change Existing Image Sizes

Changing existing thumbnail and resize sizes in G2.0/2.0.1/2.0.2 is a pain. You have to go to each album, one by one, and edit the settings there.

In G2.1 and later versions (and in the current nightly snapshots) you can change the settings recursively if you want to. That is, if you want to change the thumbnail size for all albums, browse to your root album, click Edit Album and then change the settings with the Use this thumbnail size in all subalbums checkbox ticked.

The new settings are only used for new images, that is, for images that will be added to this album in future. The thumbnails and resizes of existing images will not be changed unless you tick the Recreate thumbnails and Recreate resized images checkboxes respectively.

Generating Thumbnails and Resizes

You don't have to bother about generating thumbnails and resizes. They are generated automatically when they are needed. Since generating images is computationally expensive (it takes a moment to create a thumbnail or resize) you may want to have complete control on when exactly these images are generated.

A few add item methods (e.g. add item -> from browser) offer the Create thumbnails now in the upload view which forces G2 to generate the thumbnails right when the image is added and not later when it is first used. There is no such option for resizes yet.

You can force to generate / build all thumbnails and resizes of the whole installation by browsing to Site Admin -> Maintenance -> Build all thumbnails/resizes. This task can take hours if you have thousands of images, but it can also finish in a few seconds for only a few images if your server is fast enough. Note that during the execution of this task your server will be slowed down considerably. You may also want to put G2 into maintenance mode (see config.php) during this operation.

Thumbnails and resizes are not generated on each request. That would be too slow. Instead they are generated when they are first requested and then they are stored on the harddisk of your server. Note that thumbnails and resizes are derived from the original, thus we call them internally derivatives. That's why they are stored in cache/derivative/ in your G2 storage folder (usually g2data/).