473,605 Members | 2,703 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem in large size image uploading.

kamill
71 New Member
Dear All,
I am uploading a image file and after resize the image i am saving it. My script is working fine with small size images but when i am trying to upload big size image, i am getting below error.
Error 500 - Internal server error
An internal server error has occured!
Please try again later.

My ini settings are as below

  • file_uploads: On
  • upload_max_file size: 20M
  • max_input_time: -1
  • memory_limit: 40M
  • max_execution_t ime: 50000
  • post_max_size: 8M
System Linux infong 2.4 #1 SMP Wed Sep 26 00:19:50 CEST 2007 i686 GNU/Linux
PHP Version 4.4.8

Same code is working on local server.

Please help me to overcome from this frustrating issue.

Regards,
Kamill
Jun 23 '08 #1
2 2049
kamill
71 New Member
Hi all,
I have find out that when i commented createthumb() function call, the script become able to upload large image size but i am unable identify the wrong syntax.
My php code is below
[PHP]
$newImage= $_FILES['newImage']['name'];
$name='img'.$_S ESSION['id'].'.jpeg';
$newImageName=' images/profile/'.$name;
move_uploaded_f ile($_FILES["newImage"]["tmp_name"],$newImageName) ;

$newwidth=110;
$newheight=110;
createthumb($ne wImageNameBig,$ newImageName,$n ewwidth,$newhei ght );

function createthumb($fi lename,$target, $newwidth,$newh eight )
{
// Get new sizes
list($width, $height) = getimagesize($f ilename);

// Get Proportional Dimensions
if ($width > $height) {
$thumb_w=$newwi dth;
$thumb_h=$heigh t*($newheight/$width);
}
if ($width < $height) {
$thumb_w=$width *($newwidth/$height);
$thumb_h=$newhe ight;
}
if ($width == $height) {
$thumb_w=$newwi dth;
$thumb_h=$newhe ight;
}

// Center Image
$x = ( $newwidth - $thumb_w ) / 2;
$y = ( $newheight - $thumb_h ) / 2;

// Load
$thumb = imagecreatetrue color($newwidth , $newheight);
$source = imagecreatefrom jpeg($filename) ;

// Change Background
$white = imagecoloralloc ate($thumb, 255, 255, 255);
imagefill($thum b, 0, 0, $white);

// Resize
imagecopyresize d($thumb, $source, $x, $y, 0, 0, $thumb_w, $thumb_h, $width, $height);
//imagecopyresamp led($thumb, $source, $x, $y, 0, 0, $thumb_w, $thumb_h, $width, $height);
// Output
imagejpeg($thum b, $target);
// Free Memory
imagedestroy($t humb);
imagedestroy($s ource);
}

[/PHP]
Jun 23 '08 #2
Atli
5,058 Recognized Expert Expert
I don't think this is a problem with your code, but rather with your server.

You say this is working on your local server, but not you host.
What are the differences between the two?
Are they running the same PHP version with the same settings?

Is it possible that your host is limiting the resources you can use in such a way that it would cut off your script when it is using to much RAM or CPU?
Jun 23 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2449
by: Tim | last post by:
I meet problem on uploading a file with a large file size. Below is my code, how can I modify in order to be able to upload a large file successfully ? Thank for your help. upload.html: <html> <body><br><br><center> <form action="upload.php" method=post enctype="multipart/form-data"> File upload: <input type=file name="userfile"> <input type=submit value="send"><br> </form>
1
2198
by: Jonathan | last post by:
Hi everyone, I have a problem with the file uploading in Asp.Net and I have read a lot on forums on this but never found an answer. Here is the problem: I know Asp.Net maximum Length for uploading a file to the server is 4Mo but I changed that maximum to about 10Mo in my web.config file : <httpRuntime executionTimeout="45" maxRequestLength="10000" useFullyQualifiedRedirectUrl="true" />
4
4808
by: Ian N | last post by:
Hi i'm having a problem with file permissions of upload, they appear to be being set to only readable by the administrator, so anyone browsing the site gets a 403 forbidden error when they try and view the image. I've tried adding the following line: - chmod($uploadfile, 444); and also a few variations on it but to no avail.
1
1747
by: David | last post by:
Hello. I can't upload large file with HtmlInputFile control:( Is there any file size limitation in HtmlInputFile control? If yes how can I upload to server large size file? Than you.
11
9568
by: Parrot | last post by:
Is there any routine I can call to reduce the size of an image file after uploading a file from a client. I am looking to reduce file sizes programmatically using C# in my web page after uploading. I know that Photoshop can do it but I need to do it dynamically in my web page. I tried doing it myself with some of the Bitmap thumbnail instructions but the resulting image is very bad. I need a file reduction routine that creates a good image...
3
2599
by: Charlie | last post by:
Hi: I'm working on an application that uploads images into binary fields on SQL Server. Before submitting, I would like to validate size of image (ie, 75 pixels by 75 pixels) so that images are always correct size. How do I programmtically validate image size? Thanks, Charlie
2
5950
by: prakharv | last post by:
Hi All, Below is the code which I am using to upload a jpeg file to the server. But the problem I am facing is that it is not copying the entire contents of the image file to the webserver and it doesn't works on IE. Please, help me out as I am new to this and would be highly thankful if anyone has running code for uploading image files to the server using CGI either Perl or C. This code i took it from net only. #!/usr/bin/perl -w
3
1693
by: borikangel | last post by:
I'm trying to make a HTML with XSLT from XML code already made. On the page I can't see some information I want like: Item number, gender, size and price. Is suppose to be 15 row all with information. Thanks a lot for the helps ans tips! The XML Code is: <?xml version="1.0"?> <?xml:stylesheet type = "text/xsl" href = "catalog.xsl"?> <catalog> <product description="Cardigan Sweater" product_image="cardigan.jpg"> ...
1
1772
by: =?Utf-8?B?SHVzYW0=?= | last post by:
Hi EveryBody: I posted the following code two days ago when I face problem that my code could not upload large data or to be prices more than 4 MB. The code are : Dim arrayImage As Byte() = FileUpload1.FileBytes TextBox1.Text = FileUpload1.FileName Dim nStr As String =
0
8001
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8424
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8415
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
5886
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5445
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3958
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2438
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1537
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1270
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.