Hello,
right now this code I have resizes images and then places them into the uploads folder is there a way to make this code upload the orignal file sizes into uploads and make it put the smaller version in a folder called thumbs
here is the upload.php code:
<?php
include('config.php');
function uploadImage($fileName, $maxSize, $maxW, $fullPath, $relPath, $colorR, $colorG, $colorB, $maxH = null){
$folder = $relPath;
$maxlimit = $maxSize;
$allowed_ext = "jpg,jpeg,gif,png,bmp";
$match = "";
$filesize = $_FILES[$fileName]['size'];
if($filesize > 0){
$filename = strtolower($_FILES[$fileName]['name']);
$filename = preg_replace('/s/', '_', $filename);
if($filesize < 1){
$errorList[] = "File size is empty.";
}
if($filesize > $maxlimit){
$errorList[] = "File size is too big.";
}
if(count($errorList)<1){
$file_ext = preg_split("/./",$filename);
$allowed_ext = preg_split("/,/",$allowed_ext);
foreach($allowed_ext as $ext){
if($ext==end($file_ext)){
$match = "1"; // File is allowed
$NUM = time();
$front_name = substr($file_ext[0], 0, 15);
$newfilename = $front_name."_".$NUM.".".end($file_ext);
$filetype = end($file_ext);
$save = $folder.$newfilename;
if(!file_exists($save)){
list($width_orig, $height_orig) = getimagesize($_FILES[$fileName]['tmp_name']);
if($maxH == null){
if($width_orig < $maxW){
$fwidth = $width_orig;
}else{
$fwidth = $maxW;
}
$ratio_orig = $width_orig/$height_orig;
$fheight = $fwidth/$ratio_orig;
$blank_height = $fheight;
$top_offset = 0;
}else{
if($width_orig <= $maxW && $height_orig <= $maxH){
$fheight = $height_orig;
$fwidth = $width_orig;
}else{
if($width_orig > $maxW){
$ratio = ($width_orig / $maxW);
$fwidth = $maxW;
$fheight = ($height_orig / $ratio);
if($fheight > $maxH){
$ratio = ($fheight / $maxH);
$fheight = $maxH;
$fwidth = ($fwidth / $ratio);
}
}
if($height_orig > $maxH){
$ratio = ($height_orig / $maxH);
$fheight = $maxH;
$fwidth = ($width_orig / $ratio);
if($fwidth > $maxW){
$ratio = ($fwidth / $maxW);
$fwidth = $maxW;
$fheight = ($fheight / $ratio);
}
}
}
if($fheight == 0 || $fwidth == 0 || $height_orig == 0 || $width_orig == 0){
die("FATAL ERROR REPORT ERROR CODE [add-pic-line-67-orig] to <a href='http://www.atwebresults.com'>AT WEB RESULTS</a>");
}
if($fheight < 45){
$blank_height = 45;
$top_offset = round(($blank_height - $fheight)/2);
}else{
$blank_height = $fheight;
}
}
$image_p = imagecreatetruecolor($fwidth, $blank_height);
$white = imagecolorallocate($image_p, $colorR, $colorG
Using cURL to PUT
Can somebody help with the correct php code to make a cURL PUT request. Here is a sample of code below that uses POST, but I need to modify this one so that it uses PUT instead.Code: <?php
Using unserialize()
Hi there.I have some data in my database that is serialized.e.g. a:2:{i:0;s:9:"Test";i:1;s:4:"Another Test";}I'm unsure how to use unserialize to convert it into a string in the
Snapshot from video
anyone knw how to make a snapshot maker from avi n mkv format.for example if i give a direct link (mysite.com/song.avi) then it will give a snapshot in jpg format
Wordpress IE issue
So I am trying to add the background shadow to my wordpress page. It works fine in Firefox but does not in IE.So here is the original code: <?php get_header(); ?><?php
image upload script not working with png
The basic process of this php code is to take the submitted file, convert it to a small JPG thumbnail and put it into one directory and save the original file into another, but it seems that when
Check before inserting in DB ???
This is my code--------------- if ( $_POST ['Submit']){{$username = $_POST ['usernm'];$userpassword = $_POST ['userpw'];}/*insert data from the form into the db table*/ $querypost = mysql_query
chat
hello i'm amir
Website Direction...
I recently used this code to try and make it so the page loads as http://www.domain.com/ when you type in http://domain.comI thought this code would make sense and be a solution, but just loops.Could
PHP friend keyword equivalent
is there a PHP equivalent for the C++ friend keyword?
need a script for 3 pages
I have a customer who wants me to set up a site with a number of pages with the following requirements:Page A - which resides in a private directory so only he as access to it (this part is set up,