Page 1 of 1

Jpeg Reducer doesn't reduce

Posted: Wed Oct 22, 2008 5:15 am
by uncleunvoid
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: Posting Code in the Forums to learn how to do it too.


Hi this is a bit of a wide question. I just started using Jpeg Reducer and it did not reduce so far.

Here si what I am trying to do:
For an upload feature, I upload a temp file , after the user submitted the upload, the file gets a name and is moved to the user's account folder.
When finally moving it to that folder, the last step is to compress the Jpeg in order to save space on the main server.

Yet checking the file size, its not compressed.
As far as I am aware, the server is running PHP5
Here is the code:

Code: Select all

<?php
require("class.jpegreducer.php");
// copies file to new location with new name and compresses
$sourcePath = $_GET['sourcePath'];
$targetPath = $_GET['targetPath'];
// copy file
copy($sourcePath, $targetPath);
// delete old one
unlink($sourcePath);
//
//
print "errorCode=1";
//
// COMPRESS FILE
$im = new JPEGReducer($targetPath,80000);
$im->OutputImage($targetPath);
//
print "errorCode=1";
?>
The JpegReducer file is in the same folder as above code file.

Anyone any ideas?

I dont seem to get a error message from the code if I launch the code via browser (rather than calling it from flash as I am doing at the moment), the image is dislayd at the end of the process, which is probably part of the class functionality, yet no compression.


~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: Posting Code in the Forums to learn how to do it too.

Re: Jpeg Reducer doesn't reduce

Posted: Wed Oct 22, 2008 9:49 am
by pickle
The relevant JPEGReducer code would be nice. :?

Re: Jpeg Reducer doesn't reduce

Posted: Wed Oct 22, 2008 12:14 pm
by uncleunvoid
yeah i suppose. its a class I got from php.net, so I assumed it is a working class they put online(ergo I thought the problem would be somewhere else rather than in the award winning piece of OS software.

http://www.phpclasses.org/browse/packag ... targz.html