FAP SUPPORT - Photo Album Addon V2 For PhpBB2 Ported »  Show posts from    to     

Icy Phoenix


Archived phpBB Topics (Styles, Mods, Support) - FAP SUPPORT - Photo Album Addon V2 For PhpBB2 Ported



forgotz [ Sun 04 Sep, 2011 21:34 ]
Post subject: 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: [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: [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. switch ($pic_filetype) 
  17. case '.gif': 
  18. case '.jpg': 
  19. header('Content-type: image/jpeg'); 
  20. break; 
  21. case '.png': 
  22. header('Content-type: image/png'); 
  23. break; 
  24.  
  25. readfile(ALBUM_CACHE_PATH . $pic_thumbnail); 
  26. exit; 
  27.  
  28.  
  29. // -------------------------------- 
  30. // Hmm, cache is empty. Try to re-generate! 
  31. // -------------------------------- 
  32.  
  33. $pic_size = @getimagesize(ALBUM_UPLOAD_PATH . $pic_filename); 
  34. $pic_width = $pic_size[0]; 
  35. $pic_height = $pic_size[1]; 
  36.  
  37. $gd_errored = FALSE; 
  38. switch ($pic_filetype) 
  39. case '.gif': 
  40. $read_function = 'imagecreatefromgif'; 
  41. $pic_filetype = '.jpg'; 
  42. break; 
  43. case '.jpg': 
  44. $read_function = 'imagecreatefromjpeg'; 
  45. break; 
  46. case '.png': 
  47. $read_function = 'imagecreatefrompng'; 
  48. break; 
  49.  
  50. $src = @$read_function(ALBUM_UPLOAD_PATH . $pic_filename); 
  51.  
  52. if (!$src) 
  53. $gd_errored = TRUE; 
  54. $pic_thumbnail = ''; 
  55. else if( ($pic_width > $album_config['thumbnail_size']) or ($pic_height > $album_config['thumbnail_size']) ) 
  56. // ---------------------------- 
  57. // Resize it 
  58. // ---------------------------- 
  59.  
  60. if ($pic_width > $pic_height) 
  61. $thumbnail_width = $album_config['thumbnail_size']; 
  62. $thumbnail_height = $album_config['thumbnail_size'] * ($pic_height/$pic_width); 
  63. else 
  64. $thumbnail_height = $album_config['thumbnail_size']; 
  65. $thumbnail_width = $album_config['thumbnail_size'] * ($pic_width/$pic_height); 
  66.  
  67. $thumbnail = ($album_config['gd_version'] == 1) ? @imagecreate($thumbnail_width, $thumbnail_height) : @imagecreatetruecolor($thumbnail_width, $thumbnail_height); 
  68.  
  69. $resize_function = ($album_config['gd_version'] == 1) ? 'imagecopyresized' : 'imagecopyresampled'; 
  70.  
  71. @$resize_function($thumbnail, $src, 0, 0, 0, 0, $thumbnail_width, $thumbnail_height, $pic_width, $pic_height); 
  72. else 
  73. $thumbnail = $src; 
  74.  
  75. if (!$gd_errored) 
  76. if ($album_config['thumbnail_cache'] == 1) 
  77. // ------------------------ 
  78. // Re-generate successfully. Write it to disk! 
  79. // ------------------------ 
  80.  
  81. $pic_thumbnail = $pic_filename; 
  82.  
  83. switch ($pic_filetype) 
  84. case '.jpg': 
  85. @imagejpeg($thumbnail, ALBUM_CACHE_PATH . $pic_thumbnail, $album_config['thumbnail_quality']); 
  86. break; 
  87. case '.png': 
  88. @imagepng($thumbnail, ALBUM_CACHE_PATH . $pic_thumbnail); 
  89. break; 
  90.  
  91. @chmod(ALBUM_CACHE_PATH . $pic_thumbnail, 0777); 
  92.  
  93.  
  94. // ---------------------------- 
  95. // After write to disk, donot forget to send to browser also 
  96. // ---------------------------- 
  97.  
  98. switch ($pic_filetype) 
  99. case '.jpg': 
  100. @imagejpeg($thumbnail, '', $album_config['thumbnail_quality']); 
  101. break; 
  102. case '.png': 
  103. @imagepng($thumbnail); 
  104. break; 
  105.  
  106. exit; 
  107. else 
  108. // ---------------------------- 
  109. // It seems you have not GD installed :( 
  110. // ---------------------------- 
  111.  
  112. header('Content-type: image/jpeg'); 
  113. readfile('images/nothumbnail.jpg'); 
  114. exit; 
  115.  


This is a screen of personal album page in Firefox (using thumbnail script)
ff_personal

This is a screen of personal album page in IE (using thumbnail script)
ie_personal

This is a screen of pic page in IE (using pic script)
ie_album_pic

This is a screen of pic page in Firefox (using pic script)
ff_album_pic


Joshua203 [ Sun 04 Sep, 2011 23:11 ]
Post subject: Re: Photo Album Addon V2 For PhpBB2 Ported
please use code tags around codes in posts forgotz, thanks in advance


Mighty Gorgon [ Wed 07 Sep, 2011 20:20 ]
Post subject: 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?


forgotz [ Thu 08 Sep, 2011 00:26 ]
Post subject: 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, http://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


forgotz [ Sat 10 Sep, 2011 08:16 ]
Post subject: Re: Photo Album Addon V2 For PhpBB2 Ported
Bump


Mighty Gorgon [ Mon 12 Sep, 2011 23:12 ]
Post subject: 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.




Powered by Icy Phoenix