Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 05-15-2009, 10:29 PM Image upload problem
Junior Talker

Posts: 3
Name: Bill Bent
Trades: 0
Please help me figure out why this will only show jpeg images uploaded other formats dont show up at all after upload.

Attached is the two php files that I think are the issue. If you need to see more please let me know.

Any help will be greatly appreciated as I have been trying to figure this out for weeks.

Thanks
Attached Files
File Type: txt place-ad-norestrict.txt (45.0 KB, 3 views)
wbent79 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-16-2009, 04:11 AM Re: Image upload problem
lizciz's Avatar
Super Spam Talker

Posts: 807
Name: Mattias Nordahl
Location: Sweden
Trades: 0
I have only briefly eyed your code, but it seems you are only handling jpegs at some places in the code.
PHP Code:
// This line
if(imagejpeg($tmp,$thumbnailpath,100));

// and this line
$src imagecreatefromjpeg($filepath);

// occurs a couple of times 
__________________
Your answers will only be as good as your question. Formulate it well and give all the necessary information.
lizciz is online now
Reply With Quote
View Public Profile Visit lizciz's homepage!
 
Old 05-16-2009, 11:27 AM Re: Image upload problem
Junior Talker

Posts: 3
Name: Bill Bent
Trades: 0
Thanks lizciz
wbent79 is offline
Reply With Quote
View Public Profile
 
Old 05-16-2009, 12:32 PM Re: Image upload problem
Junior Talker

Posts: 3
Name: Bill Bent
Trades: 0
I tried this and now the upload fails with no errors just shows a blank page.

if(isset($_FILES["photo1"]["tmp_name"])&& $_FILES["photo1"]["tmp_name"]!="")
{
$file_temp = $_FILES['photo1']['tmp_name'];
$original_file_name = $_FILES['photo1']['name'];

$new_file_name = time().$original_file_name;
$filepath = "../temp_files/".$new_file_name;

move_uploaded_file( $file_temp , $filepath );

// Creating Full Image
$thumbnail = "FULL".$new_file_name;
$thumbnailpath = "../temp_files/".$thumbnail;
$imageBoxSize = 207;
list($fileWidth,$fileHeight, $image_type)=getimagesize($filepath);

if($fileHeight > $fileWidth)
{$unit = $fileWidth/$fileHeight; $width = $imageBoxSize * $unit; $height = $imageBoxSize;}
else
{$unit = $fileHeight/$fileWidth; $height = $imageBoxSize * $unit; $width = $imageBoxSize;}


$tmp = imagecreatetruecolor($width,$height);
imagecopyresampled($tmp,$src,0,0,0,0,$width,$heigh t,$fileWidth,$fileHeight);
if(imagegif($tmp,$thumbnailpath,100));
if(imagejpeg($tmp,$thumbnailpath,100));
if(imagepng($tmp,$thumbnailpath,100));

//Creating Thumbnail
$thumbnail = "TN".$new_file_name;
$thumbnailpath = "../temp_files/".$thumbnail;
$imageBoxSize = 50;
list($fileWidth,$fileHeight)=getimagesize($filepat h);

if($fileHeight > $fileWidth)
{$unit = $fileWidth/$fileHeight; $width = $imageBoxSize * $unit; $height = $imageBoxSize;}
else
{$unit = $fileHeight/$fileWidth; $height = $imageBoxSize * $unit; $width = $imageBoxSize;}

$src = imagecreatefromgif($filepath);
$src = imagecreatefromjpeg($filepath);
$src = imagecreatefrompng($filepath);
$tmp = imagecreatetruecolor($width,$height);
imagecopyresampled($tmp,$src,0,0,0,0,$width,$heigh t,$fileWidth,$fileHeight);
if(imagegif($tmp,$thumbnailpath,100));
if(imagejpeg($tmp,$thumbnailpath,100));
if(imagepng($tmp,$thumbnailpath,100));

//Creating MainPage Thumbnail
$thumbnail = "MAIN".$new_file_name;
$thumbnailpath = "../temp_files/".$thumbnail;
$imageBoxSize = 87;
list($fileWidth,$fileHeight)=getimagesize($filepat h);

if($fileHeight > $fileWidth)
{$unit = $fileWidth/$fileHeight; $width = $imageBoxSize * $unit; $height = $imageBoxSize;}
else
{$unit = $fileHeight/$fileWidth; $height = $imageBoxSize * $unit; $width = $imageBoxSize;}

$src = imagecreatefromgif($filepath);
$src = imagecreatefromjpeg($filepath);
$src = imagecreatefrompng($filepath);
$tmp = imagecreatetruecolor($width,$height);
imagecopyresampled($tmp,$src,0,0,0,0,$width,$heigh t,$fileWidth,$fileHeight);
if(imagegif($tmp,$thumbnailpath,100));
if(imagejpeg($tmp,$thumbnailpath,100));
if(imagepng($tmp,$thumbnailpath,100));


//Deleting Original File
unlink($filepath);

$_SESSION['photo1'] = $new_file_name;
wbent79 is offline
Reply With Quote
View Public Profile
 
Old 05-18-2009, 12:31 PM Re: Image upload problem
Junior Talker

Posts: 1
Trades: 0
Try this php upload script & thumbnail creator! working with all web images, also gif, jpeg, png.
__________________

Please login or register to view this content. Registration is FREE
or
Please login or register to view this content. Registration is FREE
AaliyahRoma is offline
Reply With Quote
View Public Profile Visit AaliyahRoma's homepage!
 
Reply     « Reply to Image upload problem
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 1.47360 seconds with 13 queries