Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Only keep thumbnail and erase original image ?
cakissimo Offline
Junior Member
**
Posts: 26
Joined: Mar 2014
Post: #1
Only keep thumbnail and erase original image ?
Hello,


I have a xthread field type image, i use

"Image Thumbnail Generation"
350x350

"Display Format"
<img src="{URL}/thumb350x350" alt="{FILENAME}" title="{FILENAME}" style="margin: 3px; " />

I'm using a lot of thumbnails but never the original file. To save space, I'd like to prevent the original from being saved on disk but only keep a thumbnail of 350px.

A way to this automatically without intervening manually ?
10-24-2014 06:57 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #2
RE: Only keep thumbnail and erase original image ?
It won't ever be supported, because it would break stuff like rebuild thumbnails (meaning you're stuck with whatever thumbnail you generate).

If you absolutely must have it though, maybe try this code edit (I have not tested it so don't know if it works - please test it before using it).
In inc/xthreads/xt_upload.php, find

PHP Code:
1
2
3
4
5
6
7
8
	if(!empty($img_dimensions) && !empty($tf['fileimgthumbs'])) {
		// generate thumbnails
		$attacharray['thumbs'] = xthreads_build_thumbnail($tf['fileimgthumbs'], $attacharray['aid'], $tf['field'], $new_file, $path, $month_dir, $img_dimensions);
		$attacharray['thumbs']['orig'] = $origdimarray;
		$attacharray['thumbs'] = serialize($attacharray['thumbs']);
	}
	
	return $attacharray;

Replace with

PHP Code:
1
2
3
4
5
6
7
8
	if(!empty($img_dimensions) && !empty($tf['fileimgthumbs'])) {
		// generate thumbnails
		$attacharray['thumbs'] = xthreads_build_thumbnail($tf['fileimgthumbs'], $attacharray['aid'], $tf['field'], $new_file, $path, $month_dir, $img_dimensions);
		$attacharray['thumbs']['orig'] = $origdimarray;
		$attacharray['thumbs'] = serialize($attacharray['thumbs']);
	}
	@unlink($new_file);
	return $attacharray;


It's an ugly hack, and a side effect is that it may still generate junk directories etc, but it solves the space problem at least.


My Blog
10-25-2014 10:34 PM
Find all posts by this user Quote this message in a reply
cakissimo Offline
Junior Member
**
Posts: 26
Joined: Mar 2014
Post: #3
RE: Only keep thumbnail and erase original image ?
Quote:it would break stuff like rebuild thumbnails (meaning you're stuck with whatever thumbnail you generate).

Hmmm, sure...
Thanks for the modification, i don't use it for the moment...maybe it's a bad idea Ouch
10-30-2014 10:05 PM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: