Jpeg Reducer doesn't reduce

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
uncleunvoid
Forum Newbie
Posts: 4
Joined: Tue Jul 03, 2007 8:29 am

Jpeg Reducer doesn't reduce

Post 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.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Jpeg Reducer doesn't reduce

Post by pickle »

The relevant JPEGReducer code would be nice. :?
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
uncleunvoid
Forum Newbie
Posts: 4
Joined: Tue Jul 03, 2007 8:29 am

Re: Jpeg Reducer doesn't reduce

Post 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
Post Reply