Server side image resize on upload

Looking for a MOD? Have a MOD request? Post here for help. (Note: This forum is community supported; phpBB does not have official MOD authors)
Get Involved
User avatar
Lumpy Burgertushie
Registered User
Posts: 68303
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Server side image resize on upload

Post by Lumpy Burgertushie »

sorry but if you can't find your files then you may not be ready for MODDing the code yet. ;)

there is a folder named includes, all of the functions files are in that folder.


luck,
robert
I'm baaaaaccckkkk. still doing work on donation basis. PM your needs.

Premium phpBB 3.3 Styles by PlanetStyles.net

If nobody is in the forest, does a tree really fall?
beltguy
Registered User
Posts: 55
Joined: Tue Jul 01, 2014 11:52 pm

Re: Server side image resize on upload

Post by beltguy »

Sorry to drag this up again.

I have been trying to get a server side image resize modification to work.

I have the same forum on two different sites one I will call test and one public (both on GoDaddy).

On the test site, I applied a mod described here: http://jerrywalsh.org/2009/automaticall ... -0409.html It worked great on the test site but not the public site. This is described in this thread: viewtopic.php?f=46&t=2250146&p=13665951 ... #p13665951

As I mentioned in that thread, I compared every ACP setting and any related function_xxx programs and they all looked the same.

I finally gave up and tried the mod in this thread. I am pretty sure I pasted the two scripts in the correct place and cleared the cache. I don't get an error message, but I do get a screen in the main website (WP format) that says file not found. Wish I got an error message, but no such luck.

I tried changing the htaccess file in the root directory with the suggested addition, but the result is that I am blocked from accessing the forum. When I deleted the modification I am then able to access the forum.

Since neither mod worked, I suspect there is some setting in ACP that is still not right.

I have spent many hours on this effort. The "public" forum will go public in a couple of weeks and I really would like to have one of these mods working.

Any help appreciated

Jim
Jim Shepherd
Evergreen, CO
User avatar
Oyabun1
Former Team Member
Posts: 23162
Joined: Sun May 17, 2009 1:05 pm
Location: Australia
Name: Bill

Re: Server side image resize on upload

Post by Oyabun1 »

As you were told in your other topic on this issue the problem is likely nothing to do with phpBB or ACP settings, but because of resource limits on your server. Resizing huge images requires a considerable amount of resources (considerable in server terms).
                      Support Request Template
3.0.x: Knowledge Base Styles Support MOD Requests
3.1.x: Knowledge BaseStyles SupportExtension Requests
beltguy
Registered User
Posts: 55
Joined: Tue Jul 01, 2014 11:52 pm

Re: Server side image resize on upload

Post by beltguy »

I had replied that GoDaddy is very generous with a 32M limit in php.ini

Also, I am testing with a 1.2M picture.

Jim
Jim Shepherd
Evergreen, CO
beltguy
Registered User
Posts: 55
Joined: Tue Jul 01, 2014 11:52 pm

Re: Server side image resize on upload

Post by beltguy »

OK, at the risk of upsetting folks reading this thread, I have to ask the question: Is there a possibility that the WordPress side of our site is causing a conflict with posting uploading large photo (up to 2M)?

I ask this because neither this mod, or the Jerry Walsh mod work. The Jerry Walsh mod worked fine on my test site where the site directory does not have a WP installation. Also, while there is no error message for the photo upload, it does give me a "file not found" in a WP related screen.

Jim
Jim Shepherd
Evergreen, CO
User avatar
Mick
Support Team Member
Support Team Member
Posts: 22919
Joined: Fri Aug 29, 2008 9:49 am
Location: Watching cricket probably.

Re: Server side image resize on upload

Post by Mick »

@beltguy: The simple answer is 'possibly'. Can you disable WP and try it?
"The more connected we get the more alone we become" - Kyle Broflovski©
hershuk
Registered User
Posts: 39
Joined: Fri Jan 13, 2012 3:39 am

Re: Server side image resize on upload

Post by hershuk »

blackbird.rus wrote:functions_upload.php
Add function

Code: Select all

	
/**
* Resize images with the true diemensions (800*600)
*/
function resize_images()
{
	if ( $this->is_image() ) {
	$limite_largeur = "800px";
	$limite_hauteur = "600px";
	$size = getimagesize($this->destination_file);
	$largeur = $size[0];
	$hauteur = $size[1];
	if($hauteur > $limite_hauteur OR $largeur > $limite_largeur)
	{
	if($largeur > $limite_largeur)
	{
	$hauteur = $hauteur / ($largeur / $limite_largeur);
	$largeur = $limite_largeur;
	}
	if($hauteur > $limite_hauteur)
	{
	$largeur = $largeur / ($hauteur / $limite_hauteur);
	$hauteur = $limite_hauteur;
	}
	
	$destination = imagecreatetruecolor($largeur, $hauteur);
	if ( $this->extension == "jpg" || $this->extension == "jpeg" ) $source = imagecreatefromjpeg($this->destination_file);
	elseif ( $this->extension == "png" ) $source = imagecreatefrompng($this->destination_file);
	elseif ( $this->extension == "gif" ) $source = imagecreatefromgif($this->destination_file);
				
	imagecopyresampled($destination, $source, 0, 0, 0, 0, $largeur, $hauteur, $size[0], $size[1]);
	if ( $this->extension == "jpg" || $this->extension == "jpeg" ) imagejpeg($destination, $this->destination_file);
	elseif ( $this->extension == "png" ) imagepng($destination, $this->destination_file);
	elseif ( $this->extension == "gif" ) imagegif($destination, $this->destination_file);
	}
}
}
in function "move_file" add

Code: Select all

	if ( $this->is_image() ) 
	{
		$this->resize_images();
	}
befor

Code: Select all

	phpbb_chmod($this->destination_file, $chmod); 
There is no "move_file" function in my "functions_upload.php"
Locked

Return to “[3.0.x] MOD Requests”