Removing original picture? Removing original picture?
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Removing original picture?

Started by Raph, February 10, 2004, 08:28:51 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Raph

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

Casper

See this thread, answer's in the last post.
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

Raph


Casper

It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

Raph

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 :(

Casper

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:
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

Raph


MaThIbUs

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!

hyperion

The pop-up is in the displayimage.php file if I recall corectly.
&quot;Then, Fletch,&quot; that bright creature said to him, and the voice was very kind, &quot;let&#039;s begin with level flight . . . .&quot;

-Richard Bach, Jonathan Livingston Seagull

(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.mozilla.org%2Fproducts%2Ffirefox%2Fbuttons%2Fgetfirefox_small.png&hash=9f6d645801cbc882a52f0ee76cfeda02625fc537)

Casper

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.
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

Joachim Müller

edit diplayimage.php and find        $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
        $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

hyperion

Mathibus,

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

$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:


$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.
&quot;Then, Fletch,&quot; that bright creature said to him, and the voice was very kind, &quot;let&#039;s begin with level flight . . . .&quot;

-Richard Bach, Jonathan Livingston Seagull

(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.mozilla.org%2Fproducts%2Ffirefox%2Fbuttons%2Fgetfirefox_small.png&hash=9f6d645801cbc882a52f0ee76cfeda02625fc537)

MaThIbUs

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...

hyperion

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.  



$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:


       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:


       // Check that picture file size is lower than the maximum allowed
       if (filesize($uploaded_pic) > ($CONFIG['max_upl_size'] << 10)) {
            @unlink($uploaded_pic);
&quot;Then, Fletch,&quot; that bright creature said to him, and the voice was very kind, &quot;let&#039;s begin with level flight . . . .&quot;

-Richard Bach, Jonathan Livingston Seagull

(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.mozilla.org%2Fproducts%2Ffirefox%2Fbuttons%2Fgetfirefox_small.png&hash=9f6d645801cbc882a52f0ee76cfeda02625fc537)

MaThIbUs