This is the display code from album_pic script
Code: [Download] [Hide]
- switch ( $pic_filetype )
- {
- case '.png':
- header('Content-type: image/png');
- break;
- case '.gif':
- header('Content-type: image/gif');
- break;
- case '.jpg':
- header('Content-type: image/jpeg');
- break;
- default:
- die('The filename data in the DB was corrupted');
- }
- readfile(ALBUM_UPLOAD_PATH . $thispic['pic_filename']);
- exit;
This is the display code from album_thumbnail
Code: [Download] [Hide]
- if( ($pic_filetype != '.jpg') and ($pic_filetype != '.png') and ($pic_filetype != '.gif') )
- {
- // --------------------------------
- // GD does not support GIF so we must SEND a premade No-thumbnail pic then EXIT
- // --------------------------------
- header('Content-type: image/jpeg');
- readfile($images['no_thumbnail']);
- exit;
- }
- else
- {
- // --------------------------------
- // Check thumbnail cache. If cache is available we will SEND & EXIT
- // --------------------------------
- if( ($album_config['thumbnail_cache'] == 1) and ($pic_thumbnail != '') and file_exists(ALBUM_CACHE_PATH . $pic_thumbnail) )
- {
- switch ($pic_filetype)
- {
- case '.gif':
- case '.jpg':
- header('Content-type: image/jpeg');
- break;
- case '.png':
- header('Content-type: image/png');
- break;
- }
- readfile(ALBUM_CACHE_PATH . $pic_thumbnail);
- exit;
- }
- // --------------------------------
- // Hmm, cache is empty. Try to re-generate!
- // --------------------------------
- $pic_size = @getimagesize(ALBUM_UPLOAD_PATH . $pic_filename);
- $pic_width = $pic_size[0];
- $pic_height = $pic_size[1];
- $gd_errored = FALSE;
- switch ($pic_filetype)
- {
- case '.gif':
- $read_function = 'imagecreatefromgif';
- $pic_filetype = '.jpg';
- break;
- case '.jpg':
- $read_function = 'imagecreatefromjpeg';
- break;
- case '.png':
- $read_function = 'imagecreatefrompng';
- break;
- }
- $src = @$read_function(ALBUM_UPLOAD_PATH . $pic_filename);
- if (!$src)
- {
- $gd_errored = TRUE;
- $pic_thumbnail = '';
- }
- else if( ($pic_width > $album_config['thumbnail_size']) or ($pic_height > $album_config['thumbnail_size']) )
- {
- // ----------------------------
- // Resize it
- // ----------------------------
- if ($pic_width > $pic_height)
- {
- $thumbnail_width = $album_config['thumbnail_size'];
- $thumbnail_height = $album_config['thumbnail_size'] * ($pic_height/$pic_width);
- }
- else
- {
- $thumbnail_height = $album_config['thumbnail_size'];
- $thumbnail_width = $album_config['thumbnail_size'] * ($pic_width/$pic_height);
- }
- $thumbnail = ($album_config['gd_version'] == 1) ? @imagecreate($thumbnail_width, $thumbnail_height) : @imagecreatetruecolor($thumbnail_width, $thumbnail_height);
- $resize_function = ($album_config['gd_version'] == 1) ? 'imagecopyresized' : 'imagecopyresampled';
- @$resize_function($thumbnail, $src, 0, 0, 0, 0, $thumbnail_width, $thumbnail_height, $pic_width, $pic_height);
- }
- else
- {
- $thumbnail = $src;
- }
- if (!$gd_errored)
- {
- if ($album_config['thumbnail_cache'] == 1)
- {
- // ------------------------
- // Re-generate successfully. Write it to disk!
- // ------------------------
- $pic_thumbnail = $pic_filename;
- switch ($pic_filetype)
- {
- case '.jpg':
- @imagejpeg($thumbnail, ALBUM_CACHE_PATH . $pic_thumbnail, $album_config['thumbnail_quality']);
- break;
- case '.png':
- @imagepng($thumbnail, ALBUM_CACHE_PATH . $pic_thumbnail);
- break;
- }
- @chmod(ALBUM_CACHE_PATH . $pic_thumbnail, 0777);
- }
- // ----------------------------
- // After write to disk, donot forget to send to browser also
- // ----------------------------
- switch ($pic_filetype)
- {
- case '.jpg':
- @imagejpeg($thumbnail, '', $album_config['thumbnail_quality']);
- break;
- case '.png':
- @imagepng($thumbnail);
- break;
- }
- exit;
- }
- else
- {
- // ----------------------------
- // It seems you have not GD installed :(
- // ----------------------------
- header('Content-type: image/jpeg');
- readfile('images/nothumbnail.jpg');
- exit;
- }
- }
This is a screen of personal album page in Firefox (using thumbnail script)
This is a screen of personal album page in IE (using thumbnail script)
This is a screen of pic page in IE (using pic script)
This is a screen of pic page in Firefox (using pic script)
Photo Album Add-on.zip | ||
Description: | here is the ported mod thus far | Download |
Filename: | Photo Album Add-on.zip | |
Filesize: | 139.21 KB | |
Downloaded: | 245 Time(s) |