473,804 Members | 2,191 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

File Upload Problem with Thumbnails

I have a very simple file upload script which creates a thumbnail of
the file (jpg) upon uploading. This works fine with small images,
however, if i try to upload a file over about 1mb the thumbnail
dosen't show. Any ideas ?
Thanks for any advice.

Mar 26 '07 #1
11 1676
ca***********@y ahoo.co.uk schrieb:
I have a very simple file upload script which creates a thumbnail of
the file (jpg) upon uploading. This works fine with small images,
however, if i try to upload a file over about 1mb the thumbnail
dosen't show. Any ideas ?
Thanks for any advice.
Maybe post_max_size is set to 1M in your php.ini?
Mar 26 '07 #2
No, the post_max is set at 8M
Thanks

Mar 26 '07 #3
On 26 Mar, 15:06, "callieandm...@ yahoo.co.uk"
<callieandm...@ yahoo.co.ukwrot e:
No, the post_max is set at 8M
Thanks
advice is to post your code for better answers.
Do you use exif data to create the thumb, perhaps the larger jpgs
don't have that info, etc.. just guesses at this point.

Mar 26 '07 #4
On Mar 26, 5:53 am, "callieandm...@ yahoo.co.uk"
<callieandm...@ yahoo.co.ukwrot e:
I have a very simple file upload script which creates a thumbnail of
the file (jpg) upon uploading. This works fine with small images,
however, if i try to upload a file over about 1mb the thumbnail
dosen't show. Any ideas ?
Thanks for any advice.
You also need to check the size of your upload_max_file size in the
php.ini - if your post_max is 8M, then your upload_max is probably
only 2M.

Mar 26 '07 #5
The upload max is 20M.
If i try to upload a large file (over 1mb) it uploads fine, its just
that the thumbnail is not created.

The code is :
$tsize = "300"; //thumbnails size (pixel)
$path = "uploads/"; //image path, where the images should be
uploaded to
$tpath = "thumbs/"; //your thumbnails path
$name="$uploade d_file_name";
$imgf = "$uploaded_file _name";
$thbf = $tpath.$imgf;
function createthumb($na me,$filename,$n ew_w,$new_h){
$system=explode ('.',$name);
if (preg_match('/jpg|jpeg|JPG/',$system[1])){
$src_img=imagec reatefromjpeg($ name);
}
if (preg_match('/png|PNG/',$system[1])){
$src_img=imagec reatefrompng($n ame);
}
if (preg_match('/gif|GIF/',$system[1])){
$src_img=imagec reatefromgif($n ame);
}

$old_x=imageSX( $src_img);
$old_y=imageSY( $src_img);
if ($old_x $old_y) {
$thumb_w=$new_w ;
$thumb_h=$old_y *($new_h/$old_x);
}
if ($old_x < $old_y) {
$thumb_w=$old_x *($new_w/$old_y);
$thumb_h=$new_h ;
}
if ($old_x == $old_y) {
$thumb_w=$new_w ;
$thumb_h=$new_h ;
}

$dst_img=ImageC reateTrueColor( $thumb_w,$thumb _h);
imagecopyresamp led($dst_img,$s rc_img,0,0,0,0, $thumb_w,$thumb _h,$old_x,
$old_y);
if (preg_match("/png/",$system[1]))
{
imagepng($dst_i mg,$filename);
}
if (preg_match("/gif/",$system[1]))
{
imagegif($dst_i mg,$filename);
}
else {
imagejpeg($dst_ img,$filename);
}
imagedestroy($d st_img);
imagedestroy($s rc_img);
}
createthumb($pa th.$imgf,$tpath .$imgf,$tsize,$ tsize);
Mar 26 '07 #6
I have a very simple file upload script which creates a thumbnail of
the file (jpg) upon uploading. This works fine with small images,
however, if i try to upload a file over about 1mb the thumbnail
dosen't show. Any ideas ?
Thanks for any advice.
Does the full jpg gets uploaded properly? In that case, it is not in the
upload settings.

I guess that you use the gd image functions. In that case, note that a
jpg is a compressed image. To work with it, it must be uncompressed. If
you want to resample it, you'd probably have both the original and the
target uncompressed in memory at some point. If you configure PHP to use
only a limited amount of memory, that memory may be too little, even if
the uploaded file is not that big. Does increasing the memory limit help?

Best regards,
--
Willem Bogaerts

Application smith
Kratz B.V.
http://www.kratz.nl/
Mar 26 '07 #7
On 26 Mar, 15:48, Willem Bogaerts
<w.bogae...@kra tz.maardanzonde rditstuk.nlwrot e:
I have a very simple file upload script which creates a thumbnail of
the file (jpg) upon uploading. This works fine with small images,
however, if i try to upload a file over about 1mb the thumbnail
dosen't show. Any ideas ?
Thanks for any advice.

Does the full jpg gets uploaded properly? In that case, it is not in the
upload settings.

I guess that you use the gd image functions. In that case, note that a
jpg is a compressed image. To work with it, it must be uncompressed. If
you want to resample it, you'd probably have both the original and the
target uncompressed in memory at some point. If you configure PHP to use
only a limited amount of memory, that memory may be too little, even if
the uploaded file is not that big. Does increasing the memory limit help?

Best regards,
--
Willem Bogaerts

Application smith
Kratz B.V.http://www.kratz.nl/
uploads are slow, i think this is a max execution problem time
problem, as you script works fine and fast for 2-3MB files, tested on
15MB file - /then/ the memory was high, but otherwise pretty small.
2*1024^2 / 30 is about 500kbits/s which is kinda what you expect the
wrong end of ADSL to be - the upper limit for us poor UK'rs

Mar 26 '07 #8
On 26 Mar, 15:48, Willem Bogaerts
<w.bogae...@kra tz.maardanzonde rditstuk.nlwrot e:
I have a very simple file upload script which creates a thumbnail of
the file (jpg) upon uploading. This works fine with small images,
however, if i try to upload a file over about 1mb the thumbnail
dosen't show. Any ideas ?
Thanks for any advice.

Does the full jpg gets uploaded properly? In that case, it is not in the
upload settings.

I guess that you use the gd image functions. In that case, note that a
jpg is a compressed image. To work with it, it must be uncompressed. If
you want to resample it, you'd probably have both the original and the
target uncompressed in memory at some point. If you configure PHP to use
only a limited amount of memory, that memory may be too little, even if
the uploaded file is not that big. Does increasing the memory limit help?

Best regards,
--
Willem Bogaerts

Application smith
Kratz B.V.http://www.kratz.nl/
well of course 2*8*1024^2/30 !

Mar 26 '07 #9
Mx execution time is set at 50000 which i believe is a pretty long
time ?

Mar 26 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
5617
by: Mike | last post by:
Sites using thumbnail preview for world wide web file navigation and searching. Below are list of sites that are either researching or providing thumbnail preview images for online web documents. Thumbnail previews are useful for web site navigation particularly in search engines and directories such as Google, Altavista and Yahoo. The preview images provide a portion of the content of the electronic file to aid in navigation.
6
1722
by: jonathanmcdougall | last post by:
I have read many posts on this subject and found no satisfying answer. I am creating a file on the server via a PHP script. The file is created using GD (imagejpeg()), though I don't think it is specific to GD. Here is what I understand so far: 1) a PHP script runs in the webserver user space. In my case, this is 'apache', though I think 'nobody' is quite frequent also. 2) creating a file from the script makes the "current" user its...
1
1668
by: Øyvind Isaksen | last post by:
Hello! I need a fileuploader that automatic make thumbnails in different sizes when an image is uploaded to the server (ASP/Win2003). Does anyone have experience with this, something to recomend? I have my own webserver, no restrictions. Thanks for all tips!!!!!
1
279
by: Will | last post by:
I've got a file upload happening to upload an image file to the server. During this process I want to also create a thumbnail of the image in the same directory, and adjust the size of the image if it's too large horizonally or vertically. I am using an httpfilescollection to gain access to the file I uploaded, but I can't figure out where to go from there. Since this is in ASP.net I'm out of luck with the graphics class in GDI+.
2
1496
by: Duane Phillips | last post by:
On image upload, I would like to save the image and also auto-create a right-size image for faster browsing, and also a thumbnail for indexes, so that slower connections do not have to wait for the larger image, and I can store preferences for each user as to what sizes they prefer to wait for. Are there PHP code/tools to do this? Would sure appreciate a pointer in the right direction. TIA.
8
2833
by: ctiggerf | last post by:
I was hopeing someone could help me out here. Been stumped on this one all day. This function 1. Checks uploaded files. 2. Creates two resized images from each (a full size, and a thumbnail). 3. Returns an array with a bool (false if the upload failed), and an error message.
6
6806
Markus
by: Markus | last post by:
I'm adding to my script a section that allows a thumbnail to be created and saved. I get this error: Warning: imagejpeg() : Unable to open '../uploads/thumb/' for writing: Is a directory in /home/.gobbles/mahcuz/mahcuz.com/upload/uploaded.php on line 129 And this is some of the code from the page: /* New code for thumbnails. Will on work if user selects "create thumb on upload" on the upload page */ //check to see if checkbox is...
8
9866
johngault
by: johngault | last post by:
I've been working with this PHP page for several days now and I'm stumped. The page is supposed to allow the user to upload up to six images for their profile. When the user adds an image it (the page coding) does verify file size, if correct it places it on the server in the users folder and with the correct names and extension, creates the thumbnail and adds the correlating file name. However, it only adds the first file name to the database....
4
1926
by: samatair | last post by:
Hi I have being working on a form. The form allows 5 image files to be uploaded with other user details. All the 5 image files are uploaded at the same time (with a single submit button click). The uploaded images are resized to thumbnails 120x120 version and 600x400 version. Maximum 1 MB size image files are allowed to upload. I have tested with this in my local server using XAMPP for Windows and its working fine. In my local server...
0
9715
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9595
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10353
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10356
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9176
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7643
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5536
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5675
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3003
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.