PhotoPost Community

PhotoPost Community (http://www.photopost.com/forum/)
-   Photopost Pro Bug Reports (http://www.photopost.com/forum/photopost-pro-bug-reports/)
-   -   thumbnail litter (http://www.photopost.com/forum/photopost-pro-bug-reports/130218-thumbnail-litter.html)

HHMagz January 30th, 2007 10:02 PM

thumbnail litter
 
I've found that if someone tries to upload an image that is smaller than the minimum set in admin panel then the thumbnail is created but the larger image is not and the user is given an error. Ok so far but the thumbnail is left as a zombie out in the thumbs directory and doesn't show up in the users gallery. I wouldn't expect the image to show up but the upload should clean up after itself if it gets an error.

Is there any automated way to clean up these zombie files?

Chuck S January 31st, 2007 10:44 AM

If a file is tried to upload under the minimum settings it should give error saying it is too small

You have some examples here

HHMagz January 31st, 2007 10:58 AM

Quote:

Originally Posted by Chuck S (Post 1188134)
If a file is tried to upload under the minimum settings it should give error saying it is too small

You have some examples here

As I stated the user does get an error saying the file is too small but the thumbnail for that image is created in the data directory anyway. The larger file is not loaded into the data directory so then you end up with a bunch of thumbnail images that don't correspond to a larger image anywhere. You only see these thumbnails if you go into the directory and have a look. They aren't visible to the user or admin through the product interface.

Chuck S January 31st, 2007 11:12 AM

So you have no example to provide okay well I will need to do testing

HHMagz January 31st, 2007 12:18 PM

It's pretty easy to verify just try and upload a file that's too small then go look for the filename.

Chuck S January 31st, 2007 12:54 PM

HMM how about in image-inc.php make this change in bold and test

Code:

Content visible to verified customers only.

HHMagz January 31st, 2007 02:45 PM

test
 
Will do - it will be this evening before I get to it though.

HHMagz January 31st, 2007 08:38 PM

Chuck I think something like this needs to happen. When the diewell is hit that doesn't write a record to the db then the product code doesn't display the image. When it dies then there is a file left in the upload directory, a file left in the thumb directory, and a file left in $filepath.

This code cleans up the problem in the case I tested - the only thing I'm not sure about is how the paths might be affected by trying to upload images into albums or other cat dirs. Can you shed any light on that?

// Too small?
if ( ($Globals['minwidth'] > 0 && $imagewidth < $Globals['minwidth']) || ($Globals['minheight'] > 0 && $imageheight < $Globals['minheight']) )
{
// @unlink($realname); commented out by GCS
// remove the large file
@unlink($filepath);

// remove the thumbnail
$thumbpath = "{$Globals['datafull']}$thecat/thumbs/$realname";
@unlink($thumbpath);

// remove the file from the uploads directory
$upimgname = "{$Globals['PP_PATH']}/uploads/$upuserid/$realname";
@unlink($upimgname);

diewell( "Your graphic $realname is too small!<br /><br />Images must be at least {$Globals['minwidth']}x{$Globals['minheight']}" );

}

Chuck S January 31st, 2007 08:52 PM

The edit I noted is correct

Chuck S January 31st, 2007 08:54 PM

what version of software you using? The lines I noted above is the edit needed

HHMagz January 31st, 2007 08:56 PM

Well yes what you wrote will remove the file from one of the 3 places that it exists.

HHMagz January 31st, 2007 09:12 PM

Version 5.62

Chuck S February 1st, 2007 09:04 AM

And what places do you think it does not get removed from?

HHMagz February 1st, 2007 09:13 AM

mods
 
After modifying the code to unlink($filepath) only, the image still remains in the ($thecat)/thumbs directory and it remains in the /uploads/(userid) directory.

Chuck S February 1st, 2007 09:48 AM

Your code should work

HHMagz February 1st, 2007 09:56 AM

It has based some more testing I've done.


All times are GMT -5. The time now is 06:54 PM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97