Delete Original Photo after upload & resize

Hello,

Many of my site users are uploading large images (naturally). I have disable viewing of large images for my user as well.

BUT

After photos are uploaded they are stored in original size. Can i delete original size or resize all photos to be small?

WITHOUT

Removing (taking away) users ability to view their pictures or album or slideshow?

Regards,

Goopchoop

Quote · 4 Feb 2010

When someone uploads a picture, the converter will make 4 thumbnails of it.  The one for viewing will crop the picture at a max of 600x600 (default) for displaying on the photos page.  You should be able to take out the original file and not hurt anything as it is no longer used.  The original file is for when someone clicks View Original Image.  So if that button is gone, no problem.


TO make sure, do a test.  Upload a rather large image and then take it away after it's thumbnailed in the sizes and see if you experience any errors.

Quote · 4 Feb 2010

Thank You for such an insight. This really helped.

Is there a folder where all large files are stored that i can delete in one shot?

or I have to delete one by one after i log-in as ADMIN?

OR Can i remove entries from database table to remove large files, is it possible?

Regards,

Goopchoop

Quote · 4 Feb 2010

Okay, here are some test i did.

1st experiment

I removed an entry from Database (which should be obvious to me that it will remove the file entry from the database).

By doing that it removed the photo from database and also i think it removed Original file as well, i can't search by hash number anymore. I am NOT SURE though.

2nd experiment:

I removed it from "Admin --> Modules --> Photos"

I can't view the file but i am not sure if it removed the file or not from physical disk.


Can someone help?


Regards,

Goopchoop

Quote · 4 Feb 2010

Hello goopchoop. You managed to get a way to automatically delete the original photos after uploading?

Best regards

Quote · 29 May 2010

Hello goopchoop. You managed to get a way to automatically delete the original photos after uploading?

Best regards

I'm keen to find something that does this too.

Quote · 1 Jun 2010

Ticket added: http://www.boonex.com/trac/dolphin/ticket/2049 asking to delete the original too when a picture is deleted from Admin panel (for now only the 3 resized images are deleted, the original stays and is consuming uselessly disk space).

Life is a fatal disease, sexually transmissible - Virginity is carcinogenic! Ask here for vaccine.
Quote · 1 Jun 2010

Fix that will delete original photo when deleting the picture from Admin panel: http://www.boonex.com/trac/dolphin/changeset/14062

Life is a fatal disease, sexually transmissible - Virginity is carcinogenic! Ask here for vaccine.
Quote · 2 Jun 2010

What about an option that will allow the admin to choose for the system to delete the originals of all media files after they have been uploaded and converted so that only the converted versions of videos and photos and what not are stored with the originals being automatically deleted?

I would prefer that to deleting individually via admin or even ftp.

-Brian

Quote · 2 Jun 2010

Thinking to photos, deleting original files could be a bad idea if some next version of Dolphin will maybe use different sizes for thumbnails and/or main pictures... The original file could be useful to produce these new resized images.

Allowing the Admin to set max width, max height and max resolution (I found pics that was uploaded with 600ppp) and resize original photos during the upload process will maybe be a better solution ?

I don't know so much about other media (video/audio). Maybe future formats (XHD, mp5, jpeg6...?) will need the original for the file to be converted ?

There is for sur a problem but as I am not sure about the best solution I added a ticket with a link to this post but no precise request... http://www.boonex.com/trac/dolphin/ticket/2050

 

Life is a fatal disease, sexually transmissible - Virginity is carcinogenic! Ask here for vaccine.
Quote · 2 Jun 2010

Would be cool to set a max height/width for the photos to be uploaded as avatar. Can safe a lot of (unused) space on your site also. Would be great if you could set this up in Admin panel

Quote · 11 Jan 2011

This would be a nice feature that should be standard with Dolphin. Makes no sense at all to resized images, if the original is still on the disc. Why not just use 1 resized, and then just set width x height with html tags throughout the site. My site is only 6 weeks old, and it already has 5,500 images, 1/4 of them being photos that should have been deleted after resizing.

Quote · 11 Jan 2011

In websites i have designed in the past i used to keep one image and resize on the fly for all other images sizes for the site.

So to point out the various problems, advantages and disadvantages to doing it that way vs how boonex choose to do it.

1) Using width and height in css/html would stretch or distort image. Some browsers will accept just one and automatically adjust the other, but there are differences between browsers on how that is handled making that option unusable for those that need cross browser compatibility.

2) Keeping one image and resizing on the fly makes sence, but creates a performance hit on pages that have lots of images.

3) Creating and storing presized images as dolphin does improves performance but eats up more HD space.

So, how it is done is a matter of choice. Boonex choose to improve performance at the expense of HD space. But some developers prefer to save HD space at the expense of performance.

https://www.deanbassett.com
Quote · 11 Jan 2011

"keep one image and resize on the fly for all other images sizes"

If you are a CDN user, depending on what CDN method you use (pull or push) and what the CDN's API is, doing this may or may not be OK.

-Smoge

Quote · 12 Jan 2011

For version 7.0.7 of dolphin.

To remove the original image after uploading and resizing, you have to add this line to your BxPhotosUploader.php on line 444

@unlink($sMediaDir . $iLastID . '' . $sExtension);

 just below the following:

createUserDataFile($iAuthorId); 

Then you must remove the button that says "View original photo," evidently to keep them to fail or load the photo does not exist in white.

In this part I have not yet arrived. Once you know something tell them.

My sense is lacking a bit of camaraderie in this forum. I am not a programmer but I managed to insert this line "looking for life." Surely there will be more of a programmer in this forum but did not want to work with people.

 

Greetings to all.. Pablo.

Quote · 27 Aug 2011

I was looking for that too.  But let me see if it is the same thing or out-of-topic :-)

  I was looking for a way to use a Thumbnail generator to use it to create a copy of the uploaded pic and save that as Original... from this copy (now the original) the Dolphin default system takes from this point and do what it is designed to do.
  So the first orignal image file would stay on the server just for a temporary time and then auto-deleted when other related tasks are completed.
  I was thinking that would be interesting to use Thumbnails Generator script, because it creates thumbnails without deforming it, preserving proportion and it can convert other files into Jpeg and with 72 dpi. 

  A lot of people try to upload pictures that was taken from regular camera,  with high definition, But they get very frustated for not be able to do that in some website, cause a negative image.
  (they don´t need to undertand things like size, pixels, dpi, width or heigh, right)..

  

  Would be great to hear some professional opinion.
  sorry if it is out-of-top

Quote · 28 Aug 2011
So, is this worth a try?
Quote · 29 Aug 2011

perm73 solution does not work for me... :-(

I user dolphin 7.0.8

 

Regards

Roman

Quote · 2 Jan 2012

How do I get Dolphin 7.0.9 automatically delete the original photo after upload?

Quote · 19 Mar 2012

take a look here

http://tutorials.modmydolphin.com/m/tutorials/view/Delete-original-photo-after-upload-to-save-disk-space

and moderators i am not spamming just giving a exact solution.

so much to do....
Quote · 19 Mar 2012

tnx. :)

Quote · 19 Mar 2012

 you're welcome

tnx. :)

 

so much to do....
Quote · 19 Mar 2012

's fix works, but the page he posted no longer exists, but I saved the fix using Google cache. I take no credit for this, it goes to Prashank35


 

First of all make a backup of /modules/boonex/photos/classes/BxPhotosUploader.php.

Edit /modules/boonex/photos/classes/BxPhotosUploader.php in your text editor and scroll to line 424 and you will see this

// force into JPG
$sExtension = '.jpg';

just above this add the red code and it will look like this

$Extension = $sExtension;

// force into JPG
$sExtension = '.jpg';

now come to line 445 you will see this

$aOwnerInfo = getProfileInfo($iAuthorId);
$bAutoAssign2Profile = ($aOwnerInfo['Avatar']==0) ? true : $bAutoAssign2Profile;
if ($bAutoAssign2Profile && $iLastID > 0) {
$this->setPrimarySharedPhoto($iLastID, $iAuthorId);
createUserDataFile($iAuthorId);
}

add code in red below it.

$aOwnerInfo = getProfileInfo($iAuthorId);
$bAutoAssign2Profile = ($aOwnerInfo['Avatar']==0) ? true : $bAutoAssign2Profile;
if ($bAutoAssign2Profile && $iLastID > 0) {
$this->setPrimarySharedPhoto($iLastID, $iAuthorId);
createUserDataFile($iAuthorId);
}

$Photo2Delete = $sMediaDir . $iLastID . $Extension;
@unlink($Photo2Delete);

now the coding part is done and your original photo will be deleted after applying this. You can check that now but we need to delete the button in the action block that says "view original" than lets do it..

open your cpanel -> phpmyadmin -> dolphin database

click sql and run this query

DELETE FROM sys_objects_actions WHERE Caption = '_bx_photos_action_view_original'

The "view original" button will be removed from the action block

and this tutorial is completed.. but you need to reapply this if a upgrade replace that file.


Quote · 11 Sep 2012

Ya, my sites are down, i planed to move it but busy with other things and what can i say i am lazy also Tongue Out lol

so much to do....
Quote · 11 Sep 2012

This was the easy part, the HARD part was deleting almost 3000 photos manually via SSH!

Quote · 11 Sep 2012
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.