<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Question2Answer Q&amp;A - Recent questions tagged large-size</title>
<link>https://www.question2answer.org/qa/tag/large-size</link>
<description>Powered by Question2Answer</description>
<item>
<title>Big avatar pics can crash Q&amp;A</title>
<link>https://www.question2answer.org/qa/6726/big-avatar-pics-can-crash-q%26a</link>
<description>

&lt;p&gt;
	If users choose really big avatar files, this can lead to a crash of Q&amp;amp;A without any error message --&amp;gt; just a white screen.&lt;/p&gt;


&lt;p&gt;
	The reason is the php function &quot;$inimage=@&lt;strong&gt;imagecreatefromstring&lt;/strong&gt;($imagedata);&quot; used in qa-util-imgage.php.&lt;/p&gt;


&lt;p&gt;
	The image is uncompressed converted in a variable to be stored in the database.
&lt;br&gt;
	If the image size is bigger than the php memory limit (memory_limit) this leads to a memory overflow - and a white, blank screen for the user :(&lt;/p&gt;


&lt;p&gt;
	[ x_size * y_size * bpp &amp;gt; memory_limit ]&lt;/p&gt;


&lt;p&gt;
	To avoid this a modification in &lt;strong&gt;qa-page-account.php&lt;/strong&gt; to check&amp;nbsp; the uncompressed (!) picture size of the uploaded avatar pic can help:&lt;/p&gt;


&lt;p&gt;
	&lt;span style=&quot;text-decoration: underline;&quot;&gt;&lt;strong&gt;original:&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;


&lt;table border=&quot;0&quot; cellpadding=&quot;1&quot; style=&quot;height: 23px; width: 500px; border-spacing: 1px;&quot;&gt;
	

&lt;tbody&gt;
		

&lt;tr&gt;
			

&lt;td style=&quot;background-color: rgb(255, 255, 204); white-space: nowrap;&quot;&gt;
				&lt;span style=&quot;font-family: courier new,courier,monospace;&quot;&gt;if (is_array(@$_FILES['file']) &amp;amp;&amp;amp; $_FILES['file']['size'])
&lt;br&gt;
				&amp;nbsp; if (!qa_set_user_avatar($qa_login_userid, file_get_contents( &lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;&lt;strong&gt;_&lt;/strong&gt;&lt;/span&gt;
&lt;br&gt;
				&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $_FILES['file']['tmp_name']), $useraccount['avatarblobid']))
&lt;br&gt;
				&amp;nbsp;&amp;nbsp;&amp;nbsp; $errors['avatar']=qa_lang_sub('users/avatar_not_read', implode( &lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;&lt;strong&gt;_&lt;/strong&gt;&lt;/span&gt;
&lt;br&gt;
				&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ', ', qa_gd_image_formats()));&lt;/span&gt;&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;


&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;


&lt;p&gt;
	&lt;span style=&quot;text-decoration: underline;&quot;&gt;&lt;strong&gt;modification:&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;


&lt;table border=&quot;0&quot; cellpadding=&quot;1&quot; style=&quot;width: 500px; border-spacing: 1px;&quot;&gt;
	

&lt;tbody&gt;
		

&lt;tr&gt;
			

&lt;td style=&quot;white-space: nowrap; background-color: rgb(255, 255, 204);&quot;&gt;
				&lt;span style=&quot;font-family: courier new,courier,monospace;&quot;&gt;if (is_array(@$_FILES['file']) &amp;amp;&amp;amp; $_FILES['file']['size']){
&lt;br&gt;
				&amp;nbsp; //check image-size to prevent memory overrun
&lt;br&gt;
				&amp;nbsp; $t_imgsize=getimagesize($_FILES['file']['tmp_name']);
&lt;br&gt;
				&amp;nbsp; //&lt;/span&gt;&lt;span style=&quot;font-family: courier new,courier,monospace;&quot;&gt;uncompressed image larger than standard php memory_limit 128M&lt;/span&gt;
&lt;br&gt;
				&lt;span style=&quot;font-family: courier new,courier,monospace;&quot;&gt;&amp;nbsp; if (($t_imgsize[0] * $t_imgsize[1] * $t_imgsize['bits'] * $t_imgsize['channels'] / 8) &lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;&lt;strong&gt;_&lt;/strong&gt;&lt;/span&gt;
&lt;br&gt;
				&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt; 100000000){
&lt;br&gt;
				&amp;nbsp;&amp;nbsp;&amp;nbsp; $errors['avatar']='image too big, please choose a smaller...';
&lt;br&gt;
				&amp;nbsp; }else{
&lt;br&gt;
				&amp;nbsp;&amp;nbsp;&amp;nbsp; if (!qa_set_user_avatar($qa_login_userid, file_get_contents( &lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;&lt;strong&gt;_&lt;/strong&gt;&lt;/span&gt;
&lt;br&gt;
				&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $_FILES['file']['tmp_name']), $useraccount['avatarblobid']))
&lt;br&gt;
				&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $errors['avatar']=qa_lang_sub('users/avatar_not_read', implode( &lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;&lt;strong&gt;_&lt;/strong&gt;&lt;/span&gt;
&lt;br&gt;
				&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ', ', qa_gd_image_formats()));
&lt;br&gt;
				&amp;nbsp; }
&lt;br&gt;
				}&lt;/span&gt;&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;


&lt;p&gt;
	You'll have to adjust the memory-limit to your individual setting of memory_limit in your php.ini !&amp;nbsp; Best way of cause is to retrieve the memory_limit online like described here: &lt;a rel=&quot;nofollow&quot; href=&quot;http://php.net/manual/en/function.ini-get.php&quot; target=&quot;_blank&quot;&gt;http://php.net/manual/en/function.ini-get.php&lt;/a&gt;&lt;/p&gt;


&lt;p&gt;
	!&amp;nbsp; attention: there are three line breaks due to the editor in the code which must be deleted again:
&lt;br&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; they are marked with the descender symbol&amp;nbsp; &quot; &lt;strong&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;_&lt;/span&gt;&lt;/strong&gt; &quot;&lt;/p&gt;


&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/6726/big-avatar-pics-can-crash-q%26a</guid>
<pubDate>Fri, 27 May 2011 18:39:14 +0000</pubDate>
</item>
<item>
<title>Image auto-resize function?</title>
<link>https://www.question2answer.org/qa/5589/image-auto-resize-function</link>
<description>Hi there,&lt;br /&gt;
&lt;br /&gt;
Is there any way to make images in answers auto-resized to fit with the default width of content.&lt;br /&gt;
&lt;br /&gt;
Recently, I've found that when a member inserts large-size pictures in his post, those overlapped and hid the side-panel's contents:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://chatscience.net/19/heterocyclic-chemistry-exercise&quot; rel=&quot;nofollow&quot;&gt;http://chatscience.net/19/heterocyclic-chemistry-exercise&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Therefore, I would like to know if there is way to make such images auto fitted.&lt;br /&gt;
&lt;br /&gt;
Best regards.</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/5589/image-auto-resize-function</guid>
<pubDate>Sun, 03 Apr 2011 00:14:26 +0000</pubDate>
</item>
</channel>
</rss>