473,383 Members | 1,963 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

imagepng returning 0 bytes image

Hi,

I've got a php image upload/resize script working...its working fine for jpegs, gifs(both transparent and not) but pngs's just wont work....it all uploads fine...creates the thumbnail....but when you view it its 0bytes...the original file uploads fine...its just after trying to resize.

Theres no errors in the log file.

Heres the relevent parts of the script...all the variables used in the script are already set....the transparency function is for the gifs...dont know if its needed for the pngs too...i've tried with and without it applied but still no luck.


Expand|Select|Wrap|Line Numbers
  1. $tn = imagecreatetruecolor($modwidth, $modheight);
  2. $image = imagecreatefrompng($file);
  3. $this->setTransparency($tn,$image);
  4.  
  5. imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height); 
  6. imagepng($tn, $save, 100); 
Feb 2 '12 #1
1 4457
YarrOfDoom
1,247 Expert 1GB
As described in the documentation, the quality parameter only goes from 0 to 9 for png images.
Feb 16 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: AMcD | last post by:
Hi! Here's a piece of code: <?php Header('Content-type: image/png');
0
by: Lee | last post by:
I am having a problem returning an image that I got from SQL Server from within an ASP page that got requested from a VC++ application. Specifically, within my application, I make an HTTP call to...
6
by: Luis Arvayo | last post by:
Hello, I am trying to convert a jpeg image stored in a PictureBox to a byte array in order to later save it to a database, but I get this error : "Generic Error in GDI+". The source code is...
11
by: tma | last post by:
I have the following HTML in use on my web page. I need it to show a graphic image on the page but do not know what to use in the codebehind to make the graphic appear. If I load the source url in...
0
by: rob lynch | last post by:
I am having a real problme returning an image from a directory that isn't under my webserver.. I.E. the image is on my F: drive but my website exists in the D: and I have no intention of adding...
6
by: Darkbyte [Work] | last post by:
Hi everybody!!! I have a script (foo.php) which uses GD to create an image and sends it to the browser: <?php $img = imagecreatefrompng("mypng.png"); /* other stuff */ ...
1
by: helraizer1 | last post by:
Hi all, I have a dynamic image that picks out data from a dynamically created .line file. showimage.php(5) <?php include("linesfile.php5"); $linesDataFile = new DataFile("data.line");
1
by: RYKLOU | last post by:
I am kinda new to php, but i do know what i am doing kinda, but i came across this error when i am trying to upload a file to my website. Fatal error: Allowed memory size of 8388608 bytes...
14
anfetienne
by: anfetienne | last post by:
hi.....i have this script (below #1) that is linked to another php file SimpleImage.php (#2) im trying to get it to work on my uploaded images but it keeps coming up errors.....i haven't altered...
1
by: neovantage | last post by:
Hey all, I am using a PHP script which creates headings at run time in a sense at page execution. I am stuck a with a very little problem which i am sure i will have the solution from experts. ...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.