*

mijo

How to resize a photo ?
« on: April 20, 2013, 08:34:28 PM »
I would like users to upload their orygial photos even 4MB on my osdate site and script should automaticly resize it to 600 kB or 600pix.

I know there was such tip on TuFat.com forum. Bat now I can not find it.
Can You help me with that ? Do you have the tip ?

 

*

Vink

  • *****
  • 329
    • NedDate.nl
Re: How to resize a photo ?
« Reply #1 on: April 21, 2013, 04:47:25 PM »
You can set these values in your Admin > global site settings > Profile pictures and thumbnails
Regards
Vink
osDate 2.19a | PHP 5.3.8 | MySQL  5.0.91

*

mijo

Re: How to resize a photo ?
« Reply #2 on: April 27, 2013, 12:23:32 PM »
I know about that in admin area. But it is for users who can resise photos themselfs. 
You know some users take photos form camera in original and they do not know how to resize. 
But I need something like in facebook . Users is uploading 4MB but Facebook resize it automaticly to smaller size and I remember there was such tip on TuFat.com forum .

*

marcam

  • ****
  • 267
Re: How to resize a photo ?
« Reply #3 on: April 27, 2013, 02:53:03 PM »

1 - Increase the size of images to 4 Mb (or more) in the admin.
Don't worry, once uploaded, the image will be resized, and you save only a 640x480 image on your server.

2 - To avoid error: "Picture size is more than allowed size of upload_snap_maxsize"
Modify in savesnap.php and admin/saveuserpics.php

- either increase the size by putting :
if ( ($picsize > $allwdsize ) || ($imginfo[0] > 6400 || $imginfo[1] > 4800) ) {
instead of: 1600 | 1200

- either delete or comment:
/* if ( ($picsize > $allwdsize ) || ($imginfo[0] > 1600 || $imginfo[1] > 1200) ) {
header( 'location: uploadsnaps.php?msg='.BIG_PIC_SIZE.'&type='.$type. '&album_id='.$album_id );
exit;
} */

Do the same in admin/saveuserpics.php

3 - To resize and record images at 640x480
Modify in savesnap.php and admin/saveuserpics.php

Find :
if ($config['images_in_db'] == 'N') {
$imgfile = saveOriginalPictureFile($img_file, $userid, 'pic', $_POST['txtpicno'], $picext, $curr_imgfile );

Modify with :
if ($config['images_in_db'] == 'N') {
//$imgfile = saveOriginalPictureFile($img_file, $userid, 'pic', $_POST['txtpicno'], $picext, $curr_imgfile);
$imgfile = createResizedPicture($img_file, 640, 480,$tnext);
$outfile = 'pic_'.$_POST['txtpicno'].'.'.$tnext;
writePictureFile($imgfile, $userimagedir.$outfile);

Do the same in admin/saveuserpics.php

4 - To avoid Fatal error: "Allowed memory size ... in ... /includes/internal/snaps_functions.php on line 85"
instead of modifying php.ini (it does not work), modify includes/internal/snaps_functions.php

Add : @ini_set("memory_limit", "64M");

I put like this:

@ini_set("memory_limit", "64M");
if ($ext == '') $ext = getPictureFileType($file);


I know about that in admin area. But it is for users who can resise photos themselfs. 
You know some users take photos form camera in original and they do not know how to resize. 
But I need something like in facebook . Users is uploading 4MB but Facebook resize it automaticly to smaller size and I remember there was such tip on TuFat.com forum .
osdate 2.5.4
Flashchat 4.7
php 5.2.7

*

mijo

Re: How to resize a photo ?
« Reply #4 on: April 30, 2013, 07:04:24 PM »
Thanks, I will try your tip.

*

TweakyK

Re: How to resize a photo ?
« Reply #5 on: May 03, 2013, 08:47:49 AM »
Thanks for the help.
It worked for me.

Re: How to resize a photo ?
« Reply #6 on: September 11, 2013, 05:18:47 PM »
This works, but not for all the images.
I have a testimage of which is a widescreen image (it is a 360-panorama)
Uploading does work, even the large filesize is fixed.
But the system is turning the image -90degrees.

And when uploading a file with the extention .JPG it shows a WRONG_TYPE message.
but a lower case extension is no problem.

//Edit
Still not working. Uploading smaller filesize is working fine, even with a large (height x width) image.
But large filesizes are not showing in our system. It looks like the upload is going well, but saving is a problem.
« Last Edit: September 11, 2013, 05:43:47 PM by nmci »

Re: How to resize a photo ?
« Reply #7 on: November 09, 2013, 04:04:09 PM »
Hi,

This works only for pictures of certain mb size and measurements. The biggest I can upload is something around 2 mb even with doubling all the settings and st in admin the size to  a GB it won't allow big resolution pics. How to increase this more? 
Kind regards,

Jan Oppeneer
working on template for 2.6 and OsdatePDO

My sites under construction:

www.oudere-homo-mannen.com
www.homosenioren.com
www.hotdatingplanet.eu

Will be testing for Osdater.

Re: How to resize a photo ?
« Reply #8 on: November 09, 2013, 05:51:21 PM »
Hi,

This works only for pictures of certain mb size and measurements. The biggest I can upload is something around 2 mb even with doubling all the settings and st in admin the size to  a GB it won't allow big resolution pics. How to increase this more? 

Hi Jan,

You may want to check your php.ini file, if you have access to it, as many hosts limit file upload size to 2 mb.
Regards,
My system:
osDate 2.6 with many changes
PHP 5.3
MySQL 5.5

Re: How to resize a photo ?
« Reply #9 on: November 13, 2013, 02:25:20 AM »
hi,

I can't find a php.ini file only one such file in default template folder but that one has a .bak extention. Probably download by accident from a differnt server because I can't find that file in the osdate folders.
Kind regards,

Jan Oppeneer
working on template for 2.6 and OsdatePDO

My sites under construction:

www.oudere-homo-mannen.com
www.homosenioren.com
www.hotdatingplanet.eu

Will be testing for Osdater.

Re: How to resize a photo ?
« Reply #10 on: November 13, 2013, 03:35:13 AM »
Hi Jan,

It is not osDate file, php.ini is the server configuration file. Very ofter on servers they limit uploads to 2 MB (it is default settings on many servers). You would need to ask your host how to increase it or ask them to do it (if they would allow it, because very often they do not). Another option would be to add entry to htaccess file, but that would be the last resort, because often it does nothing or even causes 500 server error. Many users think that there are problems with osDate, but often it is not osDate problem at all, but server configuration problem. Ask your host to increase maximum upload file size and if they refuse, add this code to htaccess file:

Code: [Select]
upload_max_filesize = 16M
That would increase maximum upload file size to 16 MB, then make sure that you do not get 500 server error and see if that works, by uploading image file bigger than 2 MB. If it would work you solved your problem and if not, then there is very little that you can do, unless you want to change your host or to get your own server.
Regards,
My system:
osDate 2.6 with many changes
PHP 5.3
MySQL 5.5

Re: How to resize a photo ?
« Reply #11 on: December 13, 2013, 05:36:05 PM »
*tips hat*
Greetings everyone.

I incorporated a script into the original osDate getsnap.php and snap_functions.php files, that resizes images on the fly, regardless of the original file size or high and width.
If anyone is interested in this, I'll gladly add it to the forum.

*tips hat*

*

Pharg

  • *****
  • 2,071
  • osDate Version: osDate Evo v1.0
Re: How to resize a photo ?
« Reply #12 on: December 14, 2013, 03:03:11 AM »
Hi Stealth,

Can you please share the code?
I am interested in how this works and helps the members.

*tips hat*
Greetings everyone.

I incorporated a script into the original osDate getsnap.php and snap_functions.php files, that resizes images on the fly, regardless of the original file size or high and width.
If anyone is interested in this, I'll gladly add it to the forum.

*tips hat*
Regards,
Pharg ( Phill )

REMEMBER: ALWAYS BACKUP BEFORE YOU MAKE ANY CHANGES!!

osDateEvo v1.0 | PHP: 5.3.42 & PHP: 5.6.18 | MySQL: 5.5.35

Re: How to resize a photo ?
« Reply #13 on: December 22, 2013, 10:33:18 AM »
Hi,

I would be interested too. Could you please upload
Kind regards,

Jan Oppeneer
working on template for 2.6 and OsdatePDO

My sites under construction:

www.oudere-homo-mannen.com
www.homosenioren.com
www.hotdatingplanet.eu

Will be testing for Osdater.

Re: How to resize a photo ?
« Reply #14 on: July 23, 2014, 03:29:35 PM »
I am interesting how this mod continues for the case when pictures are stored in database? What I have to change here
Code: [Select]
else {
           
        $newimg = base64_encode(file_get_contents($img_file));
    }
in savesnap.php