forum.coppermine-gallery.net

Support => Older/other versions => cpg1.2 Standalone Support => Topic started by: Raph on February 10, 2004, 08:28:51 am

Title: Removing original picture?
Post by: Raph on February 10, 2004, 08:28:51 am
Is there a way for me to remove the original picture? The originals are too large in size, but the resized images are perfect... is there any way I can remove the option to click the image and open the "original"? Or just remove the originals w/o having red x's?

thanks in advanced, any help will be much appreciated :)

-Raph
Title: Removing original picture?
Post by: Casper on February 10, 2004, 09:24:02 am
See this thread, answer's in the last post.
Title: Removing original picture?
Post by: Raph on February 10, 2004, 05:57:36 pm
I'm not sure what you mean :(
Title: Removing original picture?
Post by: Casper on February 10, 2004, 06:20:18 pm
:oops: sorry
I forgot to actually give you the link.  Here it is;
http://forum.coppermine-gallery.net/index.php?topic=244
Title: Removing original picture?
Post by: Raph on February 10, 2004, 06:41:03 pm
Quote from: "casper"
:oops: sorry
I forgot to actually give you the link.  Here it is;
http://forum.coppermine-gallery.net/index.php?topic=244



no problem, thanks for the link!

Only problem, is that they dont tell you what file to edit to stop the javascript pop-up :(
Title: Removing original picture?
Post by: Casper on February 10, 2004, 07:06:39 pm
taken from the post detailing the mod;

Quote from: "hyperion"
To prevent the storage of the original image, edit include/picmgmt.inc on the line before:


which of course is the picmgmt.inc.php file in the include folder  :wink:
Title: Removing original picture?
Post by: Raph on February 10, 2004, 07:14:19 pm
thanks :)
Title: Removing original picture?
Post by: MaThIbUs on February 10, 2004, 09:06:19 pm
Would it be possible to enhance this script so that the original picture gets resized to <certain dimensions> as soon as it gets uploaded, but then still a normal_image.jpg is generated so we can still use popups? This would be great!
Title: Removing original picture?
Post by: hyperion on February 10, 2004, 10:21:47 pm
The pop-up is in the displayimage.php file if I recall corectly.
Title: Removing original picture?
Post by: Casper on February 10, 2004, 10:42:20 pm
The xp_publish facility has the ability to do this, perhaps it is possible to borrow the code from there and place it in the upload.php and searchnew.php(for batch add).

edit;  just realised this is actually part of windows code, not xp_publish.php  DOH.
Title: Removing original picture?
Post by: Joachim Müller on February 11, 2004, 01:17:55 am
edit diplayimage.php and find
Code: [Select]
       $pic_html = "<a href=\"javascript:;\" onClick=\"MM_openBrWindow('displayimage.php?pid=$pid&fullsize=1','" . uniqid(rand()) . "','scrollbars=yes,toolbar=yes,status=yes,resizable=yes,width=$winsizeX,height=$winsizeY')\">";
        $pic_title = $lang_display_image_php['view_fs'] . "\n==============\n" . $pic_title; //added by gaugau
        $pic_html .= "<img src=\"" . $picture_url . "\" class=\"image\" border=\"0\" alt=\"{$lang_display_image_php['view_fs']}\" /><br />";
        $pic_html .= "</a>\n";
Replace with
Code: [Select]

        $pic_title = $lang_display_image_php['view_fs'] . "\n==============\n" . $pic_title; //added by gaugau
        $pic_html = "<img src=\"" . $picture_url . "\" class=\"image\" border=\"0\" alt=\"{$lang_display_image_php['view_fs']}\" /><br />";

Note: this will not remove the full-size pic from your server, just the link to the full-size pic will be removed (in other words: some space on your server will still be wasted).

GauGau
Title: Removing original picture?
Post by: hyperion on February 11, 2004, 05:39:19 am
Mathibus,

Yes, you can do that by using another call to the resize image function in picmgmt.inc.php.  You would place this between:

Code: [Select]
$thumb = $CONFIG['fullpath'] . $filepath . $CONFIG['thumb_pfx'] . $filename;

$imagesize = getimagesize($image);


You can be more selective with additional logic checks of your own.  Then you would call the resize function using identical source and destination paths. This will cause the new image to overwrite the old image. The resulting code would look like this:

Code: [Select]

$thumb = $CONFIG['fullpath'] . $filepath . $CONFIG['thumb_pfx'] . $filename;

resize_image($image, $image, $pixels, $CONFIG['thumb_method'], $CONFIG['thumb_use']);

$imagesize = getimagesize($image);


where $pixels is your desired pixel length for the width/height/either as specified in the Config panel.

Full Disclosure: I have not tested this, so it might not work the first time.
Title: Removing original picture?
Post by: MaThIbUs on February 11, 2004, 03:30:23 pm
Thanks GauGau, but I wanted to auto-remove those oversized images...

Thanks Hyperion, but I can't get it to work. It seems like that line of code doesn't do anything :(... But it might be my mistake; does the script automatically read $pixels or do I have to declare it myself? It would be great if it would use the Max width or height for uploaded pictures (pixels) config setting...
Title: Removing original picture?
Post by: hyperion on February 11, 2004, 06:27:06 pm
Yes, you must specify $pixels in the above example. This should give you what you want. Again, it is untested, off the top of my head kind of stuff.  

Code: [Select]


$thumb = $CONFIG['fullpath'] . $filepath . $CONFIG['thumb_pfx'] . $filename;

// Begin new code

$imagesize = getimagesize($image);

if (max($imagesize[0], $imagesize[1]) > $CONFIG[max_upl_width_height] ) {

$large_image_method = 'any';

resize_image($image, $image, $CONFIG[max_upl_width_height], $large_image_method, $CONFIG['thumb_use']);

}

// End new code

$imagesize = getimagesize($image);

if (!file_exists($thumb))
 


Then you should edit db_input.php. Find:

Code: [Select]

       if (max($imginfo[0], $imginfo[1]) > $CONFIG['max_upl_width_height']) {
            @unlink($uploaded_pic);
            cpg_die(ERROR, sprintf($lang_db_input_php['err_fsize_too_large'], $CONFIG['max_upl_width_height'], $CONFIG['max_upl_width_height']), __FILE__, __LINE__);
            // Check that picture file size is lower than the maximum allowed
        } elseif (filesize($uploaded_pic) > ($CONFIG['max_upl_size'] << 10)) {
            @unlink($uploaded_pic);


and change to:

Code: [Select]

       // Check that picture file size is lower than the maximum allowed
       if (filesize($uploaded_pic) > ($CONFIG['max_upl_size'] << 10)) {
            @unlink($uploaded_pic);
Title: Removing original picture?
Post by: MaThIbUs on February 12, 2004, 08:33:53 pm
It doesn't work. :(