A
download image_functions.php
Language: PHP
LOC: 70
Project Info
NukeEvent - Event Portal System(nukeevent)
Server: Savannah NonGNU
Type: cvs
...ent\nukeevent\modules\news\
   admin_functions.php
   article_functions.php
   config.inc.dist
   image_functions.php
   index.php
   link_functions.php
   news_functions.php
   news_index.php
   news_rssfeed.php
   news_setup.php

<?php
/**
* uplaods the image for the Index
*/
function uploadSmallImg($intId) 
{
    global $neConfig, $neDb;
	if ( empty($_FILES['small_upload']) or empty($intId) ) {
		return false;
	}	
	$tmpfile = $_FILES['small_upload'];
	$filename = $intId.'_small';
    switch($tmpfile['type']) {
		case 'image/jpeg':
		    $filename .= ".jpg";
			break;	
		case 'image/gif':
		    $filename .= ".gif";
			break;	
		case 'image/png':
		    $filename .= ".png";
			break;	
		default:
		    echo 'not_an_image';
		    return false;
			break;
	}
	@unlink(NE_IMAGE_PATH.'news/'.$intId.'_small.jpg');
	@unlink(NE_IMAGE_PATH.'news/'.$intId.'_small.png');
	@unlink(NE_IMAGE_PATH.'news/'.$intId.'_small.gif');
    neResizeImage(
	    $tmpfile['tmp_name'],
		NE_IMAGE_PATH.'news/'.$filename,
		$neConfig['news']['smallimage_width'],
		$neConfig['news']['smallimage_height']
	);
	return true;
}

function uploadBigImg($intId) 
{
    global $neConfig, $neDb;
	if ( empty($_FILES['big_upload']) or empty($intId) ) {
		return false;
	}	
	$tmpfile = $_FILES['big_upload'];
	$filename = $intId.'_big';
    switch($tmpfile['type']) {
		case 'image/jpeg':
		    $filename .= ".jpg";
			break;	
		case 'image/gif':
		    $filename .= ".gif";
			break;	
		case 'image/png':
		    $filename .= ".png";
			break;	
		default:
		    echo 'not_an_image';
		    return false;
			break;
	}
	@unlink(NE_IMAGE_PATH.'news/'.$intId.'_big.jpg');
	@unlink(NE_IMAGE_PATH.'news/'.$intId.'_big.png');
	@unlink(NE_IMAGE_PATH.'news/'.$intId.'_big.gif');
    neResizeImage(
	    $tmpfile['tmp_name'],
		NE_IMAGE_PATH.'news/'.$filename,
		$neConfig['news']['bigimage_width'],
		$neConfig['news']['bigimage_height']
	);
	return true;
}
?>

About Koders | Resources | Downloads | Support | Black Duck | Terms of Service | DMCA | Privacy Policy | Contact Us