- Posts: 13
COMMUNITY FORUM
Server error 500
- Frank Stratmann
-
- Offline
- New Member
Please Log in or Create an account to join the conversation.
- Travis Prebble
-
- Offline
- Junior Member
- Posts: 34
Which version of K2 are you using? The class.upload.php is required to use the Image tab of a K2 item in version 2+.
Please Log in or Create an account to join the conversation.
- Frank Stratmann
-
- Offline
- New Member
- Posts: 13
Which version of K2 are you using? The class.upload.php is required to use the Image tab of a K2 item in version 2+.
I use the actual one. Download yesterday. Now, my mistake, i found the class.upload.php allready. but...
I tried now:
- php.ini, switch to php5
- out comment source-passage
nothing happens. The Error is still there. Error 500.
Any other ideas?
Thanks
Please Log in or Create an account to join the conversation.
- Matthias Dohm
-
- Offline
- New Member
- Posts: 5
please check if k2 creates any file within the /media/k2/items/cache folder. K2 should create six images with different sizes for each article.
Please Log in or Create an account to join the conversation.
- Rickey Tribble
-
- Offline
- New Member
- Posts: 12
Thanks
Matthias Dohm said:Hi all,I finally managed to get the image upload working after switching to php5 and creating a php.ini did not solve the problem. So for those of you who use 1and1 hosting and still receive this error:The problem occurs inside the class.upload.php (administrator/components/com_k2/lib/class.upload.php). Starting somewhere around line 4080 there is a block (//converts image from true color, and fix transparency if needed) which looks at every single pixel of the resized image. For the XL and the L size, this giant loop is too big (at least on a 1and1 server). So if you just comment out or delete this section the image upload works perfectly.There might still occur some problems when you try to upload a GIF-image, but I tested it for JPGs and PNGs which worked fine.I hope this will help a bit.
Please Log in or Create an account to join the conversation.
- Matthias Dohm
-
- Offline
- New Member
- Posts: 5
the block that I commented out ends right above //outputs image as you wrote. The following section is responsible for saving the resized image.
Please Log in or Create an account to join the conversation.
- Frank Stratmann
-
- Offline
- New Member
- Posts: 13
Please Log in or Create an account to join the conversation.
- Travis Prebble
-
- Offline
- Junior Member
- Posts: 34
K2 uses class.upload.php without modification, so any fixes would have to be done by the author of the library.
www.verot.net/php_class_upload.htm
There are several questions in the forums regarding errors handling large images, and the only suggested solution is increasing the memory allocation for PHP.
Please Log in or Create an account to join the conversation.
- Beto Cadilhe
-
- Offline
- New Member
- Posts: 2
I get internal server error (500) only when i try to add new item. I can edit ctegories, fields ans so on, but i can´t add new itens. Is it due to my server configuration?
thanks
Please Log in or Create an account to join the conversation.
- Matthias Dohm
-
- Offline
- New Member
- Posts: 5
If this works, try to add a small image (max 640 x 480).
Please Log in or Create an account to join the conversation.
- Beto Cadilhe
-
- Offline
- New Member
- Posts: 2
Matthias Dohm said:Please try to add a new item without any image, gallery, video, etc. If this works, try to add a small image (max 640 x 480).
Please Log in or Create an account to join the conversation.
- Matthias Dohm
-
- Offline
- New Member
- Posts: 5
If you have some knowledge about php you could try the following:
Inside the administrator/components/com_k2/models/item.php file the function save() is called when you try to create an item. You could insert something like "die('everything alright');" at different positions to find out at which point the error occurs.
Please Log in or Create an account to join the conversation.
- Vathanakone Prakosay
-
- Offline
- New Member
- Posts: 4
the problem of "500 internal server .." might be comes from CGI module
Please double check with your provider wheter this is being support or not!
If so simply add in your .htaccess
Please Log in or Create an account to join the conversation.
- romansTwelve
-
- Offline
- New Member
- Posts: 6
Please Log in or Create an account to join the conversation.
- Toby Poulsom
-
- Offline
- New Member
- Posts: 1
I went through all of the steps for the fixes commented on this thread and still a 500 error ....
then I noticed that my image had a bad file name - with a space in it. Changed that and it worked fine.
Since this was the last thing I changed I can't comment on whether the other fixes were necessary for me. I am on 1 & 1 hosting and it seems to work now though.
May be just me but thought I'd mention it. Usually Joomla picks this up (maybe just through JCE editor).
Please Log in or Create an account to join the conversation.
- Patrick
-
- Offline
- New Member
- Posts: 1
just receiving internal error when putting up pics (not 500 error code)
but figured same thing
i am on donhost hosting and was having major problems only able to put up really small images
look bad when viewed in a large window removed the code for converts image from true color, and fix transparency if needed
and all is working fine the upload is very fast using joomla 2x k2 2.6.8
hope this helps some body out there
code removed was from line 4948
as follows
// converts image from true color, and fix transparency if needed
$this->log .= '- converting...<br />';
switch($this->image_convert) {
case 'gif':
// if the image is true color, we convert it to a palette
if (imageistruecolor($image_dst)) {
$this->log .= ' true color to palette<br />';
// creates a black and white mask
$mask = array(array());
for ($x = 0; $x < $this->image_dst_x; $x++) {
for ($y = 0; $y < $this->image_dst_y; $y++) {
$pixel = imagecolorsforindex($image_dst, imagecolorat($image_dst, $x, $y));
$mask[$x][$y] = $pixel;
}
}
list($red, $green, $blue) = $this->getcolors($this->image_default_color);
// first, we merge the image with the background color, so we know which colors we will have
for ($x = 0; $x < $this->image_dst_x; $x++) {
for ($y = 0; $y < $this->image_dst_y; $y++) {
if ($mask[$x][$y] > 0){
// we have some transparency. we combine the color with the default color
$pixel = imagecolorsforindex($image_dst, imagecolorat($image_dst, $x, $y));
$alpha = ($mask[$x][$y] / 127);
$pixel = round(($pixel * (1 -$alpha) + $red * ($alpha)));
$pixel = round(($pixel * (1 -$alpha) + $green * ($alpha)));
$pixel = round(($pixel * (1 -$alpha) + $blue * ($alpha)));
$color = imagecolorallocate($image_dst, $pixel, $pixel, $pixel);
imagesetpixel($image_dst, $x, $y, $color);
}
}
}
// transforms the true color image into palette, with its merged default color
if (empty($this->image_background_color)) {
imagetruecolortopalette($image_dst, true, 255);
$transparency = imagecolorallocate($image_dst, 254, 1, 253);
imagecolortransparent($image_dst, $transparency);
// make the transparent areas transparent
for ($x = 0; $x < $this->image_dst_x; $x++) {
for ($y = 0; $y < $this->image_dst_y; $y++) {
// we test wether we have enough opacity to justify keeping the color
if ($mask[$x][$y] > 120) imagesetpixel($image_dst, $x, $y, $transparency);
}
}
}
unset($mask);
}
break;
case 'jpg':
case 'bmp':
// if the image doesn't support any transparency, then we merge it with the default color
$this->log .= ' fills in transparency with default color<br />';
list($red, $green, $blue) = $this->getcolors($this->image_default_color);
$transparency = imagecolorallocate($image_dst, $red, $green, $blue);
// make the transaparent areas transparent
for ($x = 0; $x < $this->image_dst_x; $x++) {
for ($y = 0; $y < $this->image_dst_y; $y++) {
// we test wether we have some transparency, in which case we will merge the colors
if (imageistruecolor($image_dst)) {
$rgba = imagecolorat($image_dst, $x, $y);
$pixel = array('red' => ($rgba >> 16) & 0xFF,
'green' => ($rgba >> 8) & 0xFF,
'blue' => $rgba & 0xFF,
'alpha' => ($rgba & 0x7F000000) >> 24);
} else {
$pixel = imagecolorsforindex($image_dst, imagecolorat($image_dst, $x, $y));
}
if ($pixel == 127) {
// we have full transparency. we make the pixel transparent
imagesetpixel($image_dst, $x, $y, $transparency);
} else if ($pixel > 0) {
// we have some transparency. we combine the color with the default color
$alpha = ($pixel / 127);
$pixel = round(($pixel * (1 -$alpha) + $red * ($alpha)));
$pixel = round(($pixel * (1 -$alpha) + $green * ($alpha)));
$pixel = round(($pixel * (1 -$alpha) + $blue * ($alpha)));
$color = imagecolorclosest($image_dst, $pixel, $pixel, $pixel);
imagesetpixel($image_dst, $x, $y, $color);
}
}
}
break;
default:
break;
}
Please Log in or Create an account to join the conversation.