thumbnailUrl method

String thumbnailUrl({
  1. String? src,
  2. String? code,
  3. int width = 320,
  4. int height = 320,
  5. int quality = 75,
  6. bool original = false,
})

Return thumbnail image url of an upload file/image.

The src is the URL of the image or file.idx. The code is the code of the file.code, It can display a photo by the first image of the code. 주의할 점은 code 를 사용하는 경우, 이미지 캐시를 하면, 새로 업로드를 해도, 캐시된 이미지가 변경되지 않을 수 있다. 이와 같은 경우, src 에 파일 번호를 사용하는 것이 좋다.

Implementation

String thumbnailUrl({
  String? src,
  String? code,
  int width = 320,
  int height = 320,
  int quality = 75,
  bool original = false,
}) {
  String url = apiUrl.replaceAll('index.php', '');
  url += 'etc/phpThumb/phpThumb.php?q=$quality&w=$width&h=$height&f=jpeg';
  if (original) url += '&original=Y';
  if (src != null && src != '') url += "&src=$src";
  if (code != null && code != '') url += "&code=$code";

  return url;
}