Advanced search  

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]

Pages: [1]   Go Down

Author Topic: Removing original picture?  (Read 6777 times)

0 Members and 1 Guest are viewing this topic.

Raph

  • Coppermine newbie
  • Offline Offline
  • Posts: 13
Removing original picture?
« 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
Logged

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Removing original picture?
« Reply #1 on: February 10, 2004, 09:24:02 am »

See this thread, answer's in the last post.
Logged
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

  • Coppermine newbie
  • Offline Offline
  • Posts: 13
Removing original picture?
« Reply #2 on: February 10, 2004, 05:57:36 pm »

I'm not sure what you mean :(
Logged

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Removing original picture?
« Reply #3 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
Logged
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

  • Coppermine newbie
  • Offline Offline
  • Posts: 13
Removing original picture?
« Reply #4 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 :(
Logged

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Removing original picture?
« Reply #5 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:
Logged
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

  • Coppermine newbie
  • Offline Offline
  • Posts: 13
Removing original picture?
« Reply #6 on: February 10, 2004, 07:14:19 pm »

thanks :)
Logged

MaThIbUs

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 130
  • I rock.
    • http://mathibus.com/
Removing original picture?
« Reply #7 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!
Logged

hyperion

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Posts: 1317
  • - retired -
Removing original picture?
« Reply #8 on: February 10, 2004, 10:21:47 pm »

The pop-up is in the displayimage.php file if I recall corectly.
Logged
&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://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fwww.mozilla.org%2Fproducts%2Ffirefox%2Fbuttons%2Fgetfirefox_small.png&hash=9f6d645801cbc882a52f0ee76cfeda02625fc537)

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Removing original picture?
« Reply #9 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.
Logged
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

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Removing original picture?
« Reply #10 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
Logged

hyperion

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Posts: 1317
  • - retired -
Removing original picture?
« Reply #11 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.
Logged
&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://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fwww.mozilla.org%2Fproducts%2Ffirefox%2Fbuttons%2Fgetfirefox_small.png&hash=9f6d645801cbc882a52f0ee76cfeda02625fc537)

MaThIbUs

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 130
  • I rock.
    • http://mathibus.com/
Removing original picture?
« Reply #12 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...
Logged

hyperion

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Posts: 1317
  • - retired -
Removing original picture?
« Reply #13 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);
Logged
&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://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fwww.mozilla.org%2Fproducts%2Ffirefox%2Fbuttons%2Fgetfirefox_small.png&hash=9f6d645801cbc882a52f0ee76cfeda02625fc537)

MaThIbUs

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 130
  • I rock.
    • http://mathibus.com/
Removing original picture?
« Reply #14 on: February 12, 2004, 08:33:53 pm »

It doesn't work. :(
Logged
Pages: [1]   Go Up
 

Page created in 0.024 seconds with 19 queries.