Advertisement
Guest User

Spoiler script by Anonymo

a guest
Jul 23rd, 2010
560
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 19.45 KB | None | 0 0
  1. <?php
  2. /*
  3.  * This file is part of kusaba.
  4.  *
  5.  * kusaba is free software; you can redistribute it and/or modify it under the
  6.  * terms of the GNU General Public License as published by the Free Software
  7.  * Foundation; either version 2 of the License, or (at your option) any later
  8.  * version.
  9.  *
  10.  * kusaba is distributed in the hope that it will be useful, but WITHOUT ANY
  11.  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12.  * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  13.  *
  14.  * You should have received a copy of the GNU General Public License along with
  15.  * kusaba; if not, write to the Free Software Foundation, Inc.,
  16.  * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  17.  * +------------------------------------------------------------------------------+
  18.  * Upload class
  19.  * +------------------------------------------------------------------------------+
  20.  * Used for image/misc file upload through the post form on board/thread pages
  21.  * +------------------------------------------------------------------------------+
  22.  */
  23.  
  24. class Upload {
  25.     var $file_name          = '';
  26.     var $original_file_name = '';
  27.     var $file_type          = '';
  28.     var $file_md5           = '';
  29.     var $file_location      = '';
  30.     var $file_thumb_location = '';
  31.     var $file_is_special    = false;
  32.     var $imgWidth           = 0;
  33.     var $imgHeight          = 0;
  34.     var $file_size          = 0;
  35.     var $imgWidth_thumb     = 0;
  36.     var $imgHeight_thumb    = 0;
  37.     var $isreply            = false;
  38.  
  39.     function HandleUpload() {
  40.         global $tc_db, $board_class, $is_oekaki, $oekaki;
  41.        
  42.         $allowed_boards = array('test');
  43.         if(!in_array($board_class->board['name'], $allowed_boards)) {
  44.         if (isset($_POST['spoiler']))
  45.         ExitWithErrorPage('Spoiler function is not allowed in this board.');
  46.         }
  47.        
  48.         if (!$is_oekaki) {
  49.             if ($board_class->board['type'] == 0 || $board_class->board['type'] == 2 || $board_class->board['type'] == 3) {
  50.                 $imagefile_name = isset($_FILES['imagefile']) ? $_FILES['imagefile']['name'] : '';
  51.                 if ($imagefile_name != '') {
  52.                     if (strpos($_FILES['imagefile']['name'], ',') != false) {
  53.                         exitWithErrorPage(_gettext('Please select only one image to upload.'));
  54.                     }
  55.  
  56.                     if ($_FILES['imagefile']['size'] > $board_class->board['maximagesize']) {
  57.                         exitWithErrorPage(sprintf(_gettext('Please make sure your file is smaller than %dB'), $board_class->board['maximagesize']));
  58.                     }
  59.  
  60.                     switch ($_FILES['imagefile']['error']) {
  61.                     case UPLOAD_ERR_OK:
  62.                         break;
  63.                     case UPLOAD_ERR_INI_SIZE:
  64.                         exitWithErrorPage(sprintf(_gettext('The uploaded file exceeds the upload_max_filesize directive (%s) in php.ini.')), ini_get('upload_max_filesize'));
  65.                         break;
  66.                     case UPLOAD_ERR_FORM_SIZE:
  67.                         exitWithErrorPage(sprintf(_gettext('Please make sure your file is smaller than %dB'), $board_class->board['maximagesize']));
  68.                         break;
  69.                     case UPLOAD_ERR_PARTIAL:
  70.                         exitWithErrorPage(_gettext('The uploaded file was only partially uploaded.'));
  71.                         break;
  72.                     case UPLOAD_ERR_NO_FILE:
  73.                         exitWithErrorPage(_gettext('No file was uploaded.'));
  74.                         break;
  75.                     case UPLOAD_ERR_NO_TMP_DIR:
  76.                         exitWithErrorPage(_gettext('Missing a temporary folder.'));
  77.                         break;
  78.                     case UPLOAD_ERR_CANT_WRITE:
  79.                         exitWithErrorPage(_gettext('Failed to write file to disk'));
  80.                         break;
  81.                     default:
  82.                         exitWithErrorPage(_gettext('Unknown File Error'));
  83.                     }
  84.  
  85.                     $this->file_type = preg_replace('/.*(\..+)/','\1',$_FILES['imagefile']['name']);
  86.                     if ($this->file_type == '.jpeg') {
  87.                         /* Fix for the rarely used 4-char format */
  88.                         $this->file_type = '.jpg';
  89.                     }
  90.  
  91.                     $pass = true;
  92.                     if (!is_file($_FILES['imagefile']['tmp_name']) || !is_readable($_FILES['imagefile']['tmp_name'])) {
  93.                         $pass = false;
  94.                     } else {
  95.                         if ($this->file_type == '.jpg' || $this->file_type == '.gif' || $this->file_type == '.png') {
  96.                             if (!@getimagesize($_FILES['imagefile']['tmp_name'])) {
  97.                                 $pass = false;
  98.                             }
  99.                         }
  100.                     }
  101.                     if (!$pass) {
  102.                         exitWithErrorPage(_gettext('File transfer failure. Please go back and try again.'));
  103.                     }
  104.  
  105.                     $this->file_name = substr(htmlspecialchars(preg_replace('/(.*)\..+/','\1',$_FILES['imagefile']['name']), ENT_QUOTES), 0, 50);
  106.                     $this->file_name = str_replace('.','_',$this->file_name);
  107.                     if (isset($_POST['spoiler']))
  108.                         $this->original_file_name = 'Spoiler Picture';
  109.                     else
  110.                         $this->original_file_name = $this->file_name;
  111.  
  112.                     $this->file_md5 = md5_file($_FILES['imagefile']['tmp_name']);
  113.  
  114.                     $exists_thread = checkMd5($this->file_md5, $board_class->board['name'], $board_class->board['id']);
  115.                     if (is_array($exists_thread)) {
  116.                         exitWithErrorPage(_gettext('Duplicate file entry detected.'), sprintf(_gettext('Already posted %shere%s.'),'<a href="' . KU_BOARDSPATH . '/' . $board_class->board['name'] . '/res/' . $exists_thread[0] . '.html#' . $exists_thread[1] . '">','</a>'));
  117.                     }
  118.  
  119.                     if (strtolower($this->file_type) == 'svg') {
  120.                         require_once 'svg.class.php';
  121.                         $svg = new Svg($_FILES['imagefile']['tmp_name']);
  122.                         $this->imgWidth = $svg->width;
  123.                         $this->imgHeight = $svg->height;
  124.                     } else {
  125.                         $imageDim = getimagesize($_FILES['imagefile']['tmp_name']);
  126.                         $this->imgWidth = $imageDim[0];
  127.                         $this->imgHeight = $imageDim[1];
  128.                     }
  129.  
  130.                     $this->file_type = strtolower($this->file_type);
  131.                     $this->file_size = $_FILES['imagefile']['size'];
  132.  
  133.                     $filetype_forcethumb = $tc_db->GetOne("SELECT " . KU_DBPREFIX . "filetypes.force_thumb FROM " . KU_DBPREFIX . "boards, " . KU_DBPREFIX . "filetypes, " . KU_DBPREFIX . "board_filetypes WHERE " . KU_DBPREFIX . "boards.id = " . KU_DBPREFIX . "board_filetypes.boardid AND " . KU_DBPREFIX . "filetypes.id = " . KU_DBPREFIX . "board_filetypes.typeid AND " . KU_DBPREFIX . "boards.name = '" . $board_class->board['name'] . "' and " . KU_DBPREFIX . "filetypes.filetype = '" . substr($this->file_type, 1) . "';");
  134.                     if ($filetype_forcethumb != '') {
  135.                         if ($filetype_forcethumb == 0) {
  136.                             $this->file_name = time() . mt_rand(1, 99);
  137.  
  138.                             /* If this board has a load balance url and password configured for it, attempt to use it */
  139.                             if ($board_class->board['loadbalanceurl'] != '' && $board_class->board['loadbalancepassword'] != '') {
  140.                                 require_once KU_ROOTDIR . 'inc/classes/loadbalancer.class.php';
  141.                                 $loadbalancer = new Load_Balancer;
  142.  
  143.                                 $loadbalancer->url = $board_class->board['loadbalanceurl'];
  144.                                 $loadbalancer->password = $board_class->board['loadbalancepassword'];
  145.  
  146.                                 $response = $loadbalancer->Send('thumbnail', base64_encode(file_get_contents($_FILES['imagefile']['tmp_name'])), 'src/' . $this->file_name . $this->file_type, 'thumb/' . $this->file_name . 's' . $this->file_type, 'thumb/' . $this->file_name . 'c' . $this->file_type, '', $this->isreply, true);
  147.  
  148.                                 if ($response != 'failure' && $response != '') {
  149.                                     $response_unserialized = unserialize($response);
  150.  
  151.                                     $this->imgWidth_thumb = $response_unserialized['imgw_thumb'];
  152.                                     $this->imgHeight_thumb = $response_unserialized['imgh_thumb'];
  153.  
  154.                                     $imageused = true;
  155.                                 } else {
  156.                                     exitWithErrorPage(_gettext('File was not properly thumbnailed').': ' . $response);
  157.                                 }
  158.                             /* Otherwise, use this script alone */
  159.                             } else {
  160.                                 $this->file_location = KU_BOARDSDIR . $board_class->board['name'] . '/src/' . $this->file_name . $this->file_type;
  161.                                 $this->file_thumb_location = KU_BOARDSDIR . $board_class->board['name'] . '/thumb/' . $this->file_name . 's' . $this->file_type;
  162.                                 $this->file_thumb_cat_location = KU_BOARDSDIR . $board_class->board['name'] . '/thumb/' . $this->file_name . 'c' . $this->file_type;
  163.  
  164.                                 if (!move_uploaded_file($_FILES['imagefile']['tmp_name'], $this->file_location)) {
  165.                                     exitWithErrorPage(_gettext('Could not copy uploaded image.'));
  166.                                 }
  167.                                 chmod($this->file_location, 0644);
  168.  
  169.                                 if ($_FILES['imagefile']['size'] == filesize($this->file_location)) {
  170.                                     if (isset($_POST['spoiler'])) {
  171.                                         $spoiler_dir = KU_BOARDSDIR . '/css/images/spoiler.png';
  172.                                         if(!copy($spoiler_dir, $this->file_thumb_location)) {
  173.                                         exitWithErrorPage(_gettext('File was not properly thumbnailed'));
  174.                                         }
  175.                                     } else {
  176.                                         if ((!$this->isreply && ($this->imgWidth > KU_THUMBWIDTH || $this->imgHeight > KU_THUMBHEIGHT)) || ($this->isreply && ($this->imgWidth > KU_REPLYTHUMBWIDTH || $this->imgHeight > KU_REPLYTHUMBHEIGHT))) {
  177.                                             if (!$this->isreply) {
  178.                                                 if (!createThumbnail($this->file_location, $this->file_thumb_location, KU_THUMBWIDTH, KU_THUMBHEIGHT)) {
  179.                                                     exitWithErrorPage(_gettext('Could not create thumbnail.'));
  180.                                                 }
  181.                                             } else {
  182.                                                 if (!createThumbnail($this->file_location, $this->file_thumb_location, KU_REPLYTHUMBWIDTH, KU_REPLYTHUMBHEIGHT)) {
  183.                                                     exitWithErrorPage(_gettext('Could not create thumbnail.'));
  184.                                                 }
  185.                                             }
  186.                                         } else {
  187.                                             if (!createThumbnail($this->file_location, $this->file_thumb_location, $this->imgWidth, $this->imgHeight)) {
  188.                                                 exitWithErrorPage(_gettext('Could not create thumbnail.'));
  189.                                             }
  190.                                         }
  191.                                         if (!createThumbnail($this->file_location, $this->file_thumb_cat_location, KU_CATTHUMBWIDTH, KU_CATTHUMBHEIGHT)) {
  192.                                             exitWithErrorPage(_gettext('Could not create thumbnail.'));
  193.                                         }
  194.                                     }
  195.                                     $imageDim_thumb = getimagesize($this->file_thumb_location);
  196.                                     $this->imgWidth_thumb = $imageDim_thumb[0];
  197.                                     $this->imgHeight_thumb = $imageDim_thumb[1];
  198.                                     $imageused = true;
  199.                                 } else {
  200.                                     exitWithErrorPage(_gettext('File was not fully uploaded. Please go back and try again.'));
  201.                                 }
  202.                             }
  203.                         } else {
  204.                             /* Fetch the mime requirement for this special filetype */
  205.                             $filetype_required_mime = $tc_db->GetOne("SELECT `mime` FROM `" . KU_DBPREFIX . "filetypes` WHERE `filetype` = " . $tc_db->qstr(substr($this->file_type, 1)));
  206.  
  207.                             $this->file_name = htmlspecialchars_decode($this->file_name, ENT_QUOTES);
  208.                             $this->file_name = stripslashes($this->file_name);
  209.                             $this->file_name = str_replace("\x80", " ", $this->file_name);                 
  210.                             $this->file_name = str_replace(' ', '_', $this->file_name);
  211.                             $this->file_name = str_replace('#', '(number)', $this->file_name);
  212.                             $this->file_name = str_replace('@', '(at)', $this->file_name);
  213.                             $this->file_name = str_replace('/', '(fwslash)', $this->file_name);
  214.                             $this->file_name = str_replace('\\', '(bkslash)', $this->file_name);
  215.  
  216.                             /* If this board has a load balance url and password configured for it, attempt to use it */
  217.                             if ($board_class->board['loadbalanceurl'] != '' && $board_class->board['loadbalancepassword'] != '') {
  218.                                 require_once KU_ROOTDIR . 'inc/classes/loadbalancer.class.php';
  219.                                 $loadbalancer = new Load_Balancer;
  220.  
  221.                                 $loadbalancer->url = $board_class->board['loadbalanceurl'];
  222.                                 $loadbalancer->password = $board_class->board['loadbalancepassword'];
  223.  
  224.                                 if ($filetype_required_mime != '') {
  225.                                     $checkmime = $filetype_required_mime;
  226.                                 } else {
  227.                                     $checkmime = '';
  228.                                 }
  229.  
  230.                                 $response = $loadbalancer->Send('direct', $_FILES['imagefile']['tmp_name'], 'src/' . $this->file_name . $this->file_type, '', '', $checkmime, false, true);
  231.  
  232.                                 $this->file_is_special = true;
  233.                             /* Otherwise, use this script alone */
  234.                             } else {
  235.                                 $this->file_location = KU_BOARDSDIR . $board_class->board['name'] . '/src/' . $this->file_name . $this->file_type;
  236.  
  237.                                 if($this->file_type == '.mp3') {
  238.                                     require_once(KU_ROOTDIR . 'lib/getid3/getid3.php');
  239.  
  240.                                     $getID3 = new getID3;
  241.                                     $getID3->analyze($_FILES['imagefile']['tmp_name']);
  242.                                     if (isset($getID3->info['id3v2']['APIC'][0]['data']) && isset($getID3->info['id3v2']['APIC'][0]['image_mime'])) {
  243.                                         $source_data = $getID3->info['id3v2']['APIC'][0]['data'];
  244.                                         $mime = $getID3->info['id3v2']['APIC'][0]['image_mime'];
  245.                                     }
  246.                                     elseif (isset($getID3->info['id3v2']['PIC'][0]['data']) && isset($getID3->info['id3v2']['PIC'][0]['image_mime'])) {
  247.                                         $source_data = $getID3->info['id3v2']['PIC'][0]['data'];
  248.                                         $mime = $getID3->info['id3v2']['PIC'][0]['image_mime'];
  249.                                     }
  250.  
  251.                                     if($source_data) {
  252.                                         $im = imagecreatefromstring($source_data);
  253.                                         if (preg_match("/png/", $mime)) {
  254.                                             $ext = ".png";
  255.                                             imagepng($im,$this->file_location.".tmp",0,PNG_ALL_FILTERS);
  256.                                         } else if (preg_match("/jpg|jpeg/", $mime)) {
  257.                                             $ext = ".jpg";
  258.                                             imagejpeg($im, $this->file_location.".tmp");
  259.                                         } else if (preg_match("/gif/", $mime)) {
  260.                                             $ext = ".gif";
  261.                                             imagegif($im, $this->file_location.".tmp");
  262.                                         }
  263.                                         $this->file_thumb_location = KU_BOARDSDIR . $board_class->board['name'] . '/thumb/' . $this->file_name .'s'. $ext;
  264.                                         if (!$this->isreply) {
  265.                                             if (!createThumbnail($this->file_location.".tmp", $this->file_thumb_location, KU_THUMBWIDTH, KU_THUMBHEIGHT)) {
  266.                                                 exitWithErrorPage(_gettext('Could not create thumbnail.'));
  267.                                             }
  268.                                         } else {
  269.                                             if (!createThumbnail($this->file_location.".tmp", $this->file_thumb_location, KU_REPLYTHUMBWIDTH, KU_REPLYTHUMBHEIGHT)) {
  270.                                                 exitWithErrorPage(_gettext('Could not create thumbnail.'));
  271.                                             }
  272.                                         }
  273.                                         $imageDim_thumb = getimagesize($this->file_thumb_location);
  274.                                         $this->imgWidth_thumb = $imageDim_thumb[0];
  275.                                         $this->imgHeight_thumb = $imageDim_thumb[1];
  276.                                         $imageused = true;
  277.                                         unlink($this->file_location.".tmp");
  278.                                     }
  279.  
  280.  
  281.                                 }
  282.  
  283.                                 /* Move the file from the post data to the server */
  284.                                 if (!move_uploaded_file($_FILES['imagefile']['tmp_name'], $this->file_location)) {
  285.                                     exitWithErrorPage(_gettext('Could not copy uploaded image.'));
  286.                                 }
  287.  
  288.                                 /* Check if the filetype provided comes with a MIME restriction */
  289.                                 if ($filetype_required_mime != '') {
  290.                                     /* Check if the MIMEs don't match up */
  291.                                     if (mime_content_type($this->file_location) != $filetype_required_mime) {
  292.                                         /* Delete the file we just uploaded and kill the script */
  293.                                         unlink($this->file_location);
  294.                                         exitWithErrorPage(_gettext('Invalid MIME type for this filetype.'));
  295.                                     }
  296.                                 }
  297.  
  298.                                 /* Make sure the entire file was uploaded */
  299.                                 if ($_FILES['imagefile']['size'] == filesize($this->file_location)) {
  300.                                     $imageused = true;
  301.                                 } else {
  302.                                     exitWithErrorPage(_gettext('File transfer failure. Please go back and try again.'));
  303.                                 }
  304.  
  305.                                 /* Flag that the file used isn't an internally supported type */
  306.                                 $this->file_is_special = true;
  307.                             }
  308.                         }
  309.                     } else {
  310.                         exitWithErrorPage(_gettext('Sorry, that filetype is not allowed on this board.'));
  311.                     }
  312.                 } elseif (isset($_POST['embed'])) {
  313.                     if ($_POST['embed'] != '') {
  314.                         $_POST['embed'] = strip_tags(substr($_POST['embed'], 0, 20));
  315.                         $video_id = $_POST['embed'];
  316.                         $this->file_name = $video_id;
  317.  
  318.                         if ($video_id != '' && strpos($video_id, '@') == false && strpos($video_id, '&') == false) {
  319.  
  320.                             $embeds = $tc_db->GetAll("SELECT HIGH_PRIORITY * FROM `" . KU_DBPREFIX . "embeds`");
  321.                             $worked = false;
  322.  
  323.                             foreach ($embeds as $line) {
  324.                                 if ((strtolower($_POST['embedtype']) == strtolower($line['name'])) && in_array($line['filetype'], explode(',', $board_class->board['embeds_allowed']))) {
  325.                                     $worked = true;
  326.                                     $videourl_start = $line['videourl'];
  327.                                     $this->file_type = '.' . strtolower($line['filetype']);
  328.                                 }
  329.                             }
  330.  
  331.                             if (!$worked) {
  332.                                 exitWithErrorPage(_gettext('Invalid video type.'));
  333.                             }
  334.  
  335.                             $results = $tc_db->GetOne("SELECT COUNT(*) FROM `" . KU_DBPREFIX . "posts` WHERE `boardid` = " . $board_class->board['id'] . " AND `file` = " . $tc_db->qstr($video_id) . " AND `IS_DELETED` = 0");
  336.                             if ($results[0] == 0) {
  337.                                 $video_check = check_link($videourl_start . $video_id);
  338.                                 switch ($video_check[1]) {
  339.                                     case 404:
  340.                                         exitWithErrorPage(_gettext('Unable to connect to') .': '. $videourl_start . $video_id);
  341.                                         break;
  342.                                     case 303:
  343.                                         exitWithErrorPage(_gettext('Invalid video ID.'));
  344.                                         break;
  345.                                     case 302:
  346.                                         // Continue
  347.                                         break;
  348.                                     case 301:
  349.                                         // Continue
  350.                                         break;
  351.                                     case 200:
  352.                                         // Continue
  353.                                         break;
  354.                                     default:
  355.                                         exitWithErrorPage(_gettext('Invalid response code ') .':'. $video_check[1]);
  356.                                         break;
  357.                                 }
  358.                             } else {
  359.                                 $results = $tc_db->GetAll("SELECT `id`,`parentid` FROM `" . KU_DBPREFIX . "posts` WHERE `boardid` = " . $board_class->board['id'] . " AND `file` = " . $tc_db->qstr($video_id) . " AND `IS_DELETED` = 0 LIMIT 1");
  360.                                 foreach ($results as $line) {
  361.                                     $real_threadid = ($line[1] == 0) ? $line[0] : $line[1];
  362.                                     exitWithErrorPage(sprintf(_gettext('That video ID has already been posted %shere%s.'),'<a href="' . KU_BOARDSFOLDER . '/' . $board_class->board['name'] . '/res/' . $real_threadid . '.html#' . $line[1] . '">','</a>'));
  363.                                 }
  364.                             }
  365.                         } else {
  366.                             exitWithErrorPage(_gettext('Invalid ID'));
  367.                         }
  368.                     }
  369.                 }
  370.             }
  371.         } else {
  372.             $this->file_name = time() . mt_rand(1, 99);
  373.             $this->original_file_name = $this->file_name;
  374.             $this->file_md5 = md5_file($oekaki);
  375.             $this->file_type = '.png';
  376.             $this->file_size = filesize($oekaki);
  377.             $imageDim = getimagesize($oekaki);
  378.             $this->imgWidth = $imageDim[0];
  379.             $this->imgHeight = $imageDim[1];
  380.  
  381.             if (!copy($oekaki, KU_BOARDSDIR . $board_class->board['name'] . '/src/' . $this->file_name . $this->file_type)) {
  382.                 exitWithErrorPage(_gettext('Could not copy uploaded image.'));
  383.             }
  384.  
  385.             $oekaki_animation = substr($oekaki, 0, -4) . '.pch';
  386.             if (file_exists($oekaki_animation)) {
  387.                 if (!copy($oekaki_animation, KU_BOARDSDIR . $board_class->board['name'] . '/src/' . $this->file_name . '.pch')) {
  388.                     exitWithErrorPage(_gettext('Could not copy animation.'));
  389.                 }
  390.                 unlink($oekaki_animation);
  391.             }
  392.  
  393.             $thumbpath = KU_BOARDSDIR . $board_class->board['name'] . '/thumb/' . $this->file_name . 's' . $this->file_type;
  394.             $thumbpath_cat = KU_BOARDSDIR . $board_class->board['name'] . '/thumb/' . $this->file_name . 'c' . $this->file_type;
  395.             if (
  396.                 (!$this->isreply && ($this->imgWidth > KU_THUMBWIDTH || $this->imgHeight > KU_THUMBHEIGHT)) ||
  397.                 ($this->isreply && ($this->imgWidth > KU_REPLYTHUMBWIDTH || $this->imgHeight > KU_REPLYTHUMBHEIGHT))
  398.             ) {
  399.                 if (!$this->isreply) {
  400.                     if (!createThumbnail($oekaki, $thumbpath, KU_THUMBWIDTH, KU_THUMBHEIGHT)) {
  401.                         exitWithErrorPage(_gettext('Could not create thumbnail.'));
  402.                     }
  403.                 } else {
  404.                     if (!createThumbnail($oekaki, $thumbpath, KU_REPLYTHUMBWIDTH, KU_REPLYTHUMBHEIGHT)) {
  405.                         exitWithErrorPage(_gettext('Could not create thumbnail.'));
  406.                     }
  407.                 }
  408.             } else {
  409.                 if (!createThumbnail($oekaki, $thumbpath, $this->imgWidth, $this->imgHeight)) {
  410.                     exitWithErrorPage(_gettext('Could not create thumbnail.'));
  411.                 }
  412.             }
  413.             if (!createThumbnail($oekaki, $thumbpath_cat, KU_CATTHUMBWIDTH, KU_CATTHUMBHEIGHT)) {
  414.                 exitWithErrorPage(_gettext('Could not create thumbnail.'));
  415.             }
  416.  
  417.             $imgDim_thumb = getimagesize($thumbpath);
  418.             $this->imgWidth_thumb = $imgDim_thumb[0];
  419.             $this->imgHeight_thumb = $imgDim_thumb[1];
  420.             unlink($oekaki);
  421.         }
  422.     }
  423. }
  424. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement