• [Mod] Auto image resize on upload v2.0.1 (2010-12-18) 4 0 5 1
Currently:  

Author Topic: [Mod] Auto image resize on upload v2.0.1 (2010-12-18)  (Read 588371 times)

0 Members and 2 Guests are viewing this topic.

Offline tradertt

  • Jr. Member
  • **
  • Posts: 61
    • View Profile
[Mod] Auto image resize on upload.
« Reply #15 on: March 01, 2003, 01:13:03 PM »
Sorry about that .. I saw the settings already .. goign to test it out now ...

 
  show_setting_row("auto_image", "radio");
  show_setting_row("auto_image_quality");


this had some problems and I tried pasting it into wordpad b4 pasting it back... all the lines of code were there only did not appear :D

Could I suggest that you compile all into a text file... maybe it will work better :D

Just a suggestion :D thank you for your help

Offline knuckles

  • Pre-Newbie
  • Posts: 5
    • View Profile
Skips admin, won't scale defined thumbnail
« Reply #16 on: March 01, 2003, 10:30:36 PM »
V@no, I installed this hack minutes after you posted it and it worked right out of the box.  However, I was only testing it in one particular way.

Here's the problem:

1) If you use the Control Panel to upload, the images and thumbnails don't get scaled.  This could almost be a feature, but I'd rather it be an option.

2) If a member decides to upload a specific image as the thumbnail (rather than let the thumbnail get auto-generated) the images does NOT get scaled.  So I usually have a thumbnail the same size as the large image.

So far that's it.  Number 2 is the bigger headache since users have no choice but to define a thumbnail for movies and documents.  It would  be great if you can provide a hack for that.  Thanks man.  Great work BTW!

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Skips admin, won't scale defined thumbnail
« Reply #17 on: March 02, 2003, 06:13:15 AM »
Quote from: tradertt

Could I suggest that you compile all into a text file... maybe it will work better

two things stops me from doing that way:
1) in .txt files can not be used colors :?
2) dont have a host to provide download from. :( can not afford my 300kbps upload stream for extra downloads  8O



Quote from: knuckles

1) If you use the Control Panel to upload, the images and thumbnails don't get scaled.  This could almost be a feature, but I'd rather it be an option.

I didnt plan integrate it into admin control panel, becase there is already half automated fetures - auto resize images/thumbnails.

Quote from: knuckles

2) If a member decides to upload a specific image as the thumbnail (rather than let the thumbnail get auto-generated) the images does NOT get scaled.  So I usually have a thumbnail the same size as the large image.

if u mean, that thumbnails do not get resized, then, its because I didnt do it for thumbnails.

Quote from: knuckles

Great work BTW!

Thank you! :oops:
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Lord Nite

  • Newbie
  • *
  • Posts: 43
    • View Profile
[Mod] Auto image resize on upload.
« Reply #18 on: March 03, 2003, 08:48:43 AM »
Just installed this, and so far so good.

I am waiting for one of my members to upload an image before I give it a full thumbs up.  :D

Offline JackSilb

  • Pre-Newbie
  • Posts: 5
    • View Profile
    • http://www.4wdtrips.net
[Mod] Auto image resize on upload.
« Reply #19 on: March 23, 2003, 12:28:48 PM »
Hello,

I am trying to get the mod working for the last 2 hours.
I did the code mods, and started the <install_autoimage.php>
I can see the
<
 This script will modify your 4images database, so please
ALWAYS BACKUP YOUR DATABASE BEFORE RUNNING THIS MOD!

Please check out all fields shown below.
If they do not correspond to your settings, please
DO NOT START INSTALLER!
>

All the fields are correct expect I don't see the user for the database listed.

I am getting the followint error after I click start mod. database.

>
Not Found

The requested URL /4wdtrips/photogallery/< was not found on this server.
Apache/2.0.40 Server at _default_ Port 8085
>

Here is the URL on the top of the browser.
>
http://www.mydomain:8085/4wdtrips/photogallery/%3C?=$self_url?%3E
>

Can you help?

thank you.
-JACK

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
[Mod] Auto image resize on upload.
« Reply #20 on: March 23, 2003, 01:15:48 PM »
ok, redownload the installer.
for some reason your host doesnt support using <?=$variable?> instead of <?php echo $variable; ?>
hope now it's gonna work.

Quote
All the fields are correct expect I don't see the user for the database listed.

no, it was not supposed to be showed, unless u want me to add username and password... :wink:
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline JackSilb

  • Pre-Newbie
  • Posts: 5
    • View Profile
    • http://www.4wdtrips.net
Where to get the latest installer?
« Reply #21 on: March 23, 2003, 08:12:07 PM »
Hi V@no,

Where do I get the latest installer? Just to make sure I am getting the right one.

Thanks,
-JACK

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Where to get the latest installer?
« Reply #22 on: March 23, 2003, 08:16:23 PM »
Quote from: JackSilb
Hi V@no,

Where do I get the latest installer? Just to make sure I am getting the right one.

Thanks,
-JACK

omg, there is only one installer.
use the link I posted in my installation guide.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline JackSilb

  • Pre-Newbie
  • Posts: 5
    • View Profile
    • http://www.4wdtrips.net
[Mod] Auto image resize on upload.
« Reply #23 on: March 23, 2003, 08:30:38 PM »
I am using the same but the file has the same date on it.  It is not a new installer.
I was assumign that you would change something on the file. Therefore, it would have a new date.

Is the Installer file new or not? I mean, has it changed since the one I tried?

Thank you!
-JACK

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
[Mod] Auto image resize on upload.
« Reply #24 on: March 23, 2003, 09:02:30 PM »
yes, it's new file.
it was updated on 03/23/03 12:xxpm
if u still getting old file, then clear up your internet cache. :wink:
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline JackSilb

  • Pre-Newbie
  • Posts: 5
    • View Profile
    • http://www.4wdtrips.net
Still can't auto resize
« Reply #25 on: March 24, 2003, 12:11:46 AM »
Yep, the install worked.

But
The script is not working. If I upload a file that is <= the max size it work just fine.

If it needs resizing, then it is comes back saying:
>

Request Entity Too Large
The requested resource
/4wdtrips/photogallery/member.php
does not allow request data with POST requests, or the amount of data provided in the request exceeds the capacity limit.
Apache/2.0.40 Server at _default_ Port 8085

>

I have the file limit set for 1500K this file is just 650K

Do you think that this is the same deal as the install? I need to change the calls in the code or maybe something on the server?

What is next?
I apreciate your help.

-JACK

Offline gooberlx

  • Pre-Newbie
  • Posts: 6
    • View Profile
regular users can't upload?
« Reply #26 on: April 11, 2003, 04:40:03 AM »
I'm having a problem with the normal users uploading. Admin can upload and autoresize works fine, but if a regular user tries then i get:

Code: [Select]
Error uploading image file:
IMG_0594.JPG: Image size invalid
IMG_0594.JPG: Image width invalid
IMG_0594.JPG: Image heigth invalid


file size is set to 300K
images size is 600x600

the admin user was able to upload this very image perfectly. And after upload the resized image conforms more than perfectly to my settings.

any suggestions?

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
[Mod] Auto image resize on upload.
« Reply #27 on: April 11, 2003, 05:43:56 AM »
make sure u did correctly step 2.2. where the changes must be inserted before return $ok;
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline gooberlx

  • Pre-Newbie
  • Posts: 6
    • View Profile
still no go
« Reply #28 on: April 11, 2003, 06:14:01 AM »
Well, I rechecked the file and everything seems to be right.

Code: [Select]

    $this->max_width['thumb'] = $config['max_thumb_width'];
    $this->max_width['media'] = $config['max_image_width'];
    $this->max_height['thumb'] = $config['max_thumb_height'];  
    $this->max_height['media'] = $config['max_image_height'];
    $this->auto_image['media'] = $config['auto_image']; <--------------

    $this->max_size['thumb'] = $config['max_thumb_size'] * 1024;
    $this->max_size['media'] = $config['max_media_size'] * 1024;

    $this->upload_mode = $config['upload_mode'];
    $this->lang = $lang;

    $this->set_allowed_filetypes();
  }

function check_image_size() {
    $this->image_size = @getimagesize($this->upload_file);
    $ok = 1;
   if ($this->image_size[0] > $this->max_width[$this->image_type]) {
     $ok = 0;
     $this->set_error($this->lang['invalid_image_width']);
   }

   if ($this->image_size[1] > $this->max_height[$this->image_type]) {
      $ok = 0;
      $this->set_error($this->lang['invalid_image_height']);
    }
    if ($this->auto_image[$this->image_type]) { <------------
      $ok = 1; <----------------------------------------------------
    } <--------------------------------------------------------------
    return $ok;
}

Offline gooberlx

  • Pre-Newbie
  • Posts: 6
    • View Profile
[Mod] Auto image resize on upload.
« Reply #29 on: April 11, 2003, 09:29:24 AM »
I've done a little debugging and made sure the code was going through the new loop. I'm assuming that the resizing should be done before check_image_size() is called?

check_image_size() is only called for non-ADMIN users, I see, and the picture turns out to be too big because it must not have been resized yet?

Any suggestions? I've double-checked all the files and could swear they're correct.

here's my resizing snippet, I don't see anything wrong.
Code: [Select]

//--------------------------------------------
//--------- Auto Image Resizing --------------
//--------------------------------------------
if ($config['auto_image'] && !$uploaderror) {
if ($direct_upload) {
$src = MEDIA_PATH."/".$cat_id."/".$new_name;
}
else {
$src = MEDIA_TEMP_PATH."/".$new_name;
}
$do_resize = 0;
if ($image_info = @getimagesize($src)) {
if ($image_info[2] == 1 || $image_info[2] == 2 || $image_info[2] == 3) {
$do_resize = 1;
}
}
if ($do_resize) {
if (!function_exists(init_convert_options)) {
require(ROOT_PATH.'includes/image_utils.php');
}
if ($image_info[0] > $config['max_image_width'] || $image_info[1] > $config['max_image_height']) {
$convert_options = init_convert_options();
if (!$convert_options['convert_error']) {
$quality = (intval($config['auto_image_quality']) && intval($config['auto_image_quality']) <= 100) ? intval($config['auto_image_quality']) : 100;
if (!resize_image($src, $quality, $config['max_image_width'], 1)) {
$msg .= (($msg != "") ? "<br />" : "")."<b>".$lang['file_upload_error'].": ".$new_name;
$uploaderror = 1;
}
}
}
}
}
//-------------------------------------------
if (!$uploaderror) {
      $additional_field_sql = "";
      $additional_value_sql = "";


The problem occurs with both portrait and landscape pics (if that helps).