Browse Source

! Memory check option added to ACP attachment settings, attempts to fix white screen from occurring with boarder case images.

Spuds 13 years ago
parent
commit
b062f89c22

+ 8 - 3
Sources/ManageAttachments.php

@@ -99,8 +99,6 @@ function ManageAttachmentSettings($return_config = false)
 			array('select', 'attachmentEnable', array($txt['attachmentEnable_deactivate'], $txt['attachmentEnable_enable_all'], $txt['attachmentEnable_disable_new'])),
 		'',
 			// Extension checks etc.
-			array('check', 'attachmentCheckExtensions'),
-			array('text', 'attachmentExtensions', 40),
 			array('check', 'attachmentRecodeLineEndings'),
 		'',
 			// Directory and size limits.
@@ -109,8 +107,13 @@ function ManageAttachmentSettings($return_config = false)
 			array('text', 'attachmentPostLimit', 6, 'postinput' => $txt['kilobyte']),
 			array('text', 'attachmentSizeLimit', 6, 'postinput' => $txt['kilobyte']),
 			array('text', 'attachmentNumPerPostLimit', 6),
+			// Security Items
+		'',
+			// Extension checks etc.
+			array('check', 'attachmentCheckExtensions'),
+			array('text', 'attachmentExtensions', 40),
 		'',
-			// Image settings.
+			// Image checks.
 			array('warning', empty($testGD) ? 'attachment_gd_warning' : ''),
 			array('check', 'attachment_image_reencode'),
 		'',
@@ -121,6 +124,8 @@ function ManageAttachmentSettings($return_config = false)
 			array('check', 'attachmentShowImages'),
 			array('check', 'attachmentThumbnails'),
 			array('check', 'attachment_thumb_png'),
+			array('check', 'attachment_thumb_memory', 'subtext' => $txt['attachment_thumb_memory_note1'], 'postinput' => $txt['attachment_thumb_memory_note2']),
+			array('warning', 'attachment_thumb_memory_note'),
 			array('text', 'attachmentThumbWidth', 6),
 			array('text', 'attachmentThumbHeight', 6),
 	);

+ 3 - 0
Themes/default/languages/Admin.english.php

@@ -362,6 +362,9 @@ $txt['attachment_image_paranoid_warning'] = 'The extensive security checks can r
 $txt['attachment_image_paranoid'] = 'Perform extensive security checks on uploaded image attachments';
 $txt['attachmentThumbnails'] = 'Resize images when showing under posts';
 $txt['attachment_thumb_png'] = 'Save thumbnails as PNG';
+$txt['attachment_thumb_memory'] = 'Adaptive thumbnail memory';
+$txt['attachment_thumb_memory_note2'] = 'If the system can not get the memory no thumbnail will be created.';
+$txt['attachment_thumb_memory_note1'] = 'Leave this unchecked to always attempt to create a thumbnail';
 $txt['attachmentThumbWidth'] = 'Maximum width of thumbnails';
 $txt['attachmentThumbHeight'] = 'Maximum height of thumbnails';
 

+ 1 - 0
Themes/default/languages/Help.english.php

@@ -308,6 +308,7 @@ $helptxt['attachment_manager_settings'] = 'Attachments are files that members ca
 		<strong>Maximum width and height of thumbnails</strong>:<br /> Only used with the &quot;Resize images when showing under posts&quot; option, the maximum width and height to resize attachments down from.  They will be resized proportionally.';
 $helptxt['attachment_image_paranoid'] = 'Selecting this option will enable very strict security checks on image attachments. Warning! These extensive checks can fail on valid images too. It is strongly recommended to only use this option together with image re-encoding, in order to have SMF try to resample the images which fail the security checks: if successful, they will be sanitized and uploaded. Otherwise, if image re-encoding is not enabled, all attachments failing checks will be rejected.';
 $helptxt['attachment_image_reencode'] = 'Selecting this option will enable trying to re-encode the uploaded image attachments. Image re-encoding offers better security. Note however that image re-encoding also renders all animated images static. <br /> This feature is only possible if the GD module is installed on your server.';
+$helptxt['attachment_thumb_memory'] = 'The larger the source image (size & width x height), the higher the memory requirements are for the system to successfully create a thumbnail image.<br />Checking this option, the system will estimate the needed memory and will then it will request that amount.  If successful, only then will it attempt to create the thumbnail.  This will result in fewer white screen errors but may result in fewer thumbnails being created.  Leaving this unchecked the system will always try to create the thumbnail (with a fixed amount of memory).  This may result in more white screen errors.';
 $helptxt['avatar_paranoid'] = 'Selecting this option will enable very strict security checks on avatars. Warning! These extensive checks can fail on valid images too. It is strongly recommended to only use this option together with avatars re-encoding, in order to have SMF try to resample the images which fail the security checks: if successful, they will be sanitized and uploaded. Otherwise, if re-encoding of avatars is not enabled, all avatars failing checks will be rejected.';
 $helptxt['avatar_reencode'] = 'Selecting this option will enable trying to re-encode the uploaded avatars. Image re-encoding offers better security. Note however that image re-encoding also renders all animated images static. <br /> This feature is only possible if the GD module is installed on your server.';
 $helptxt['karmaMode'] = 'Karma is a feature that shows the popularity of a member. Members, if allowed, can