Hello
I would like to be able to upload an image with the webp extension.
here are my changes made:
config.php
fonctions.php
torrents-uploads.php
Erreur: Invalid image 1
Have any idea of the problem !?
Thanks
I would like to be able to upload an image with the webp extension.
here are my changes made:
config.php
$site_config['allowed_image_types'] = array(
// "mimetype" => ".ext",
"image/gif" => ".gif",
"image/pjpeg" => ".jpg",
"image/jpeg" => ".jpg",
"image/jpg" => ".jpg",
"image/png" => ".png",
"image/webp" => ".webp"
);fonctions.php
// [img=http://www/image.gif] taille img shout
$s = preg_replace("/\[img1=((https):\/\/[^\s'\"<>]+(\.gif|\.jpg|\.png|\.bmp|\.jpeg|\.webp))\]/i", "<img class='img1-shout' border='0' src=\"\\1\" width=\"100\" alt='⚠ Auncune Pochette ! ⚰' />", $s);
//
by spiritblue
$s = preg_replace("/\[img\]((https):\/\/[^\s'\"<>]+(\.gif|\.jpg|\.png|\.bmp|\.jpeg|\.webp))\[\/img\]/i", "<img border=\"0\" src=\"\\1\" alt=\"\" onload=\"NcodeImageResizer.createOn(this);\">", $s);
// [imgsmall]http://www/image.gif[/img]
$s = preg_replace("/\[imgsmall\]((https):\/\/[^\s'\"<>]+(\.gif|\.jpg|\.png|\.bmp|\.jpeg|\.webp))\[\/img\]/i", "<img border=\"0\" src=\"\\1\" height=\"150px\" alt=\"\" onload=\"NcodeImageResizer.createOn(this);\">", $s);
// [img=http://www/image.gif]
$s = preg_replace("/\[img=((https):\/\/[^\s'\"<>]+(\.gif|\.jpg|\.png|\.bmp|\.jpeg|\.webp))\]/i", "<img border=\"0\" src=\"\\1\" alt=\"\" onload=\"NcodeImageResizer.createOn(this);\">", $s);torrents-uploads.php
//upload images
$allowed_types = &$site_config["allowed_image_types"];
$inames = array();
for ($x=0; $x < 2; $x++) {
if (!($_FILES[image.$x]['name'] == "")) {
$y = $x + 1;
if (!preg_match('/^(.+)\.(jpg|gif|png|webp)$/si', $_FILES[image.$x]['name']))
show_error_msg(T_("INVAILD_IMAGE"), T_("THIS_FILETYPE_NOT_IMAGE"), 1);
if ($_FILES['image$x']['size'] > $site_config['image_max_filesize'])
show_error_msg(T_("ERROR"), T_("INVAILD_FILE_SIZE_IMAGE"), 1);
$uploaddir = $site_config["torrent_dir"]."/images/";
$ifile = $_FILES[image.$x]['tmp_name'];
$im = getimagesize($ifile);
if (!$im[2])
show_error_msg(T_("ERROR"), sprintf(T_("INVALID_IMAGE"), $y), 1);
if (!array_key_exists($im['mime'], $allowed_types))
show_error_msg(T_("ERROR"), T_("INVALID_FILETYPE_IMAGE"), 1);
$ret = SQL_Query_exec("SHOW TABLE STATUS LIKE 'torrents'");
$row = mysql_fetch_array($ret);
$next_id = $row['Auto_increment'];
$ifilename = $next_id . $x . $allowed_types[$im['mime']];
$copy = copy($ifile, $uploaddir.$ifilename);
//if (!$copy)
// show_error_msg(T_("ERROR"), sprintf(T_("IMAGE_UPLOAD_FAILED"), $y), 1);
$inames[] = $ifilename;
}}
//end upload imagesErreur: Invalid image 1
Have any idea of the problem !?
Thanks

