Icy Phoenix

     
 


This forum is locked: you cannot post, reply or edit topics.  This topic is locked: you cannot edit posts or make replies. 
Page 1 of 1
 
 
Reply with quote Download Post 
Post FAP SUPPORT - Photo Album Addon V2 For PhpBB2 Ported 
 
Have nearly completed port of Photo Album Addon v2. All has gone well except one critical aspect and that is display of pics. Display scripts are album_pic and album_thumbnail. After much research and tinkering, have concluded that header info is mixing with image info and browsers will return saying image is corrupted. Following is screenshots and code from both display scripts. Any help at all with this, would be much appreciated - am going through the "losing my mind" phase right now  

This is the display code from album_pic script
Code: [Download] [Hide]
  1. switch ( $pic_filetype ) 
  2.     case '.png': 
  3.         header('Content-type: image/png'); 
  4.         break; 
  5.     case '.gif': 
  6.         header('Content-type: image/gif'); 
  7.         break; 
  8.     case '.jpg': 
  9.         header('Content-type: image/jpeg'); 
  10.         break; 
  11.     default: 
  12.         die('The filename data in the DB was corrupted'); 
  13.  
  14. readfile(ALBUM_UPLOAD_PATH  . $thispic['pic_filename']); 
  15.  
  16. exit; 
  17.  


This is the display code from album_thumbnail
Code: [Download] [Hide]
  1.  
  2. if( ($pic_filetype != '.jpg') and ($pic_filetype != '.png') and ($pic_filetype != '.gif') ) 
  3.     // -------------------------------- 
  4.     // GD does not support GIF so we must SEND a premade No-thumbnail pic then EXIT 
  5.     // -------------------------------- 
  6.  
  7.     header('Content-type: image/jpeg'); 
  8.     readfile($images['no_thumbnail']); 
  9.     exit; 
  10. else 
  11.     // -------------------------------- 
  12.     // Check thumbnail cache. If cache is available we will SEND & EXIT 
  13.     // -------------------------------- 
  14.  
  15.     if( ($album_config['thumbnail_cache'] == 1) and ($pic_thumbnail != '') and file_exists(ALBUM_CACHE_PATH . $pic_thumbnail) ) 
  16.     { 
  17.         switch ($pic_filetype) 
  18.         { 
  19.           case '.gif': 
  20.             case '.jpg': 
  21.                 header('Content-type: image/jpeg'); 
  22.                 break; 
  23.             case '.png': 
  24.                 header('Content-type: image/png'); 
  25.                 break; 
  26.         } 
  27.  
  28.         readfile(ALBUM_CACHE_PATH . $pic_thumbnail); 
  29.         exit; 
  30.     } 
  31.  
  32.  
  33.     // -------------------------------- 
  34.     // Hmm, cache is empty. Try to re-generate! 
  35.     // -------------------------------- 
  36.  
  37.     $pic_size = @getimagesize(ALBUM_UPLOAD_PATH . $pic_filename); 
  38.     $pic_width = $pic_size[0]; 
  39.     $pic_height = $pic_size[1]; 
  40.  
  41.     $gd_errored = FALSE; 
  42.     switch ($pic_filetype) 
  43.     { 
  44.      case '.gif': 
  45.       $read_function = 'imagecreatefromgif'; 
  46.       $pic_filetype = '.jpg'; 
  47.    break; 
  48.         case '.jpg': 
  49.             $read_function = 'imagecreatefromjpeg'; 
  50.             break; 
  51.         case '.png': 
  52.             $read_function = 'imagecreatefrompng'; 
  53.             break; 
  54.     } 
  55.  
  56.     $src = @$read_function(ALBUM_UPLOAD_PATH  . $pic_filename); 
  57.  
  58.     if (!$src) 
  59.     { 
  60.         $gd_errored = TRUE; 
  61.         $pic_thumbnail = ''; 
  62.     } 
  63.     else if( ($pic_width > $album_config['thumbnail_size']) or ($pic_height > $album_config['thumbnail_size']) ) 
  64.     { 
  65.         // ---------------------------- 
  66.         // Resize it 
  67.         // ---------------------------- 
  68.  
  69.         if ($pic_width > $pic_height) 
  70.         { 
  71.             $thumbnail_width = $album_config['thumbnail_size']; 
  72.             $thumbnail_height = $album_config['thumbnail_size'] * ($pic_height/$pic_width); 
  73.         } 
  74.         else 
  75.         { 
  76.             $thumbnail_height = $album_config['thumbnail_size']; 
  77.             $thumbnail_width = $album_config['thumbnail_size'] * ($pic_width/$pic_height); 
  78.         } 
  79.  
  80.         $thumbnail = ($album_config['gd_version'] == 1) ? @imagecreate($thumbnail_width, $thumbnail_height) : @imagecreatetruecolor($thumbnail_width, $thumbnail_height); 
  81.  
  82.         $resize_function = ($album_config['gd_version'] == 1) ? 'imagecopyresized' : 'imagecopyresampled'; 
  83.  
  84.         @$resize_function($thumbnail, $src, 0, 0, 0, 0, $thumbnail_width, $thumbnail_height, $pic_width, $pic_height); 
  85.     } 
  86.     else 
  87.     { 
  88.         $thumbnail = $src; 
  89.     } 
  90.  
  91.     if (!$gd_errored) 
  92.     { 
  93.         if ($album_config['thumbnail_cache'] == 1) 
  94.         { 
  95.             // ------------------------ 
  96.             // Re-generate successfully. Write it to disk! 
  97.             // ------------------------ 
  98.  
  99.             $pic_thumbnail = $pic_filename; 
  100.  
  101.             switch ($pic_filetype) 
  102.             { 
  103.                 case '.jpg': 
  104.                     @imagejpeg($thumbnail, ALBUM_CACHE_PATH . $pic_thumbnail, $album_config['thumbnail_quality']); 
  105.                     break; 
  106.                 case '.png': 
  107.                     @imagepng($thumbnail, ALBUM_CACHE_PATH . $pic_thumbnail); 
  108.                     break; 
  109.             } 
  110.  
  111.             @chmod(ALBUM_CACHE_PATH . $pic_thumbnail, 0777); 
  112.         } 
  113.  
  114.  
  115.         // ---------------------------- 
  116.         // After write to disk, donot forget to send to browser also 
  117.         // ---------------------------- 
  118.  
  119.         switch ($pic_filetype) 
  120.         { 
  121.             case '.jpg': 
  122.                 @imagejpeg($thumbnail, '', $album_config['thumbnail_quality']); 
  123.                 break; 
  124.             case '.png': 
  125.                 @imagepng($thumbnail); 
  126.                 break; 
  127.         } 
  128.  
  129.         exit; 
  130.     } 
  131.     else 
  132.     { 
  133.         // ---------------------------- 
  134.         // It seems you have not GD installed :( 
  135.         // ---------------------------- 
  136.  
  137.         header('Content-type: image/jpeg'); 
  138.         readfile('images/nothumbnail.jpg'); 
  139.         exit; 
  140.     } 
  141.  


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: 243 Time(s)

 



 
Edited by Joshua203, Sun 04 Sep, 2011 23:09: php changed into code bbcode tags
forgotzSend private message  
Back to topPage bottom
Icy Phoenix is an open source project, you can show your appreciation and support future development by donating to the project.

Support us
 
Reply with quote Download Post 
Post Re: Photo Album Addon V2 For PhpBB2 Ported 
 
please use code tags around codes in posts forgotz, thanks in advance  
 




____________
www.DutchaGoGo.com (development/under construction ...Forever?¿?)
 
Joshua203Send private messageVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post Re: Photo Album Addon V2 For PhpBB2 Ported 
 
Hi, thank you very much for this file.

Can I please ask for which platform you did the port? Nuke?
 




____________
Luca
SEARCH is the quickest way to get support.
Icy Phoenix ColorizeIt - CustomIcy - HON
 
Mighty GorgonSend private messageSend e-mail to userVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post Re: Photo Album Addon V2 For PhpBB2 Ported 
 
You are welcome, something that I enjoy doing  Yes, it is for Nuke, currently at this site, h**p://php-evolved.com/. I also have a forum threads going on this topic here and here. As mentioned in those threads, everything is working, except PHP image generation scripts are not working (album_thumbnail.php and album_pic.php), or at least that appears to be the issue. Again, the port appears to be a success - except for the most important thing, the images will not display   Today, I started from scratch and did the port once again - still the same result. The resolution MUST be something simple. I implemented a new image class and nothing. Tried rewriting the .htaccess files and still nothing. Even downloaded the FAP and attempted a port, and that was even worse. That's all good though, because I don't want everything that comes with FAP. The port of Album Mod version 2.0.56 is all I want - clean, simple and well integrated. Visit php-evolved.com for yourself and see what I am talking about. Any help at all would be greatly appreciated. Below, I have attached the second port that I did today. Maybe this is above my pay grade, and I should leave it - but I do not wish to. Have come this far and everything else is working, it's just a shame that this one thing has tripped me up. Thanks for your reply and hope we can work together...

-K

album_v2056.zip
Description: Updated and tightened the install routine - display scripts not working but everything else is 
Download
Filename: album_v2056.zip
Filesize: 122.05 KB
Downloaded: 247 Time(s)

 



 
forgotzSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post Re: Photo Album Addon V2 For PhpBB2 Ported 
 
Bump
 



 
forgotzSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post Re: Photo Album Addon V2 For PhpBB2 Ported 
 
Just for testing purpose... can you please try to install Icy Phoenix on the same domain and test if images are shown fine in the album? At least we know that the problem is not server configuration.

I can then try to help in debugging.
 




____________
Luca
SEARCH is the quickest way to get support.
Icy Phoenix ColorizeIt - CustomIcy - HON
 
Mighty GorgonSend private messageSend e-mail to userVisit poster's website  
Back to topPage bottom
This forum is locked: you cannot post, reply or edit topics.  This topic is locked: you cannot edit posts or make replies.  Page 1 of 1
 


Display posts from previous:    

HideWas this topic useful?

Link this topic
URL
BBCode
HTML




 
Permissions List
You cannot post new topics
You cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events


  

 

  cron