• [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 588431 times)

0 Members and 1 Guest are viewing this topic.

Offline mentrid

  • Pre-Newbie
  • Posts: 4
    • View Profile
Re: [Mod] Auto image resize on upload. (updated 19/09/04)
« Reply #345 on: September 12, 2008, 11:20:13 AM »
I tried this mod in combination with
http://www.4homepages.de/forum/index.php?topic=20496.0
and it works just great on version 1.76.

If you use this mod http://www.4homepages.de/forum/index.php?topic=7700.msg22313#msg22313
to upload the big images into a seperate folder you should consider making this update, too:


admin/images.php
Search for:
Code: [Select]
if (@unlink(MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file'])) {
Replace with:
Code: [Select]
if (@unlink(MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file']) &&
            @unlink(MEDIA_PATH."/".$image_row['cat_id']."/big/".$image_row['image_media_file'])) {

This will also delete the big image from your server when you delete an image in the ACP.
Else you just delete the small file.

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [Mod] Auto image resize on upload. (updated 19/09/04)
« Reply #346 on: September 12, 2008, 11:46:57 AM »
I tried this mod in combination with
http://www.4homepages.de/forum/index.php?topic=20496.0
and it works just great on version 1.7.6

... thanks for your statement ... ;)
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline born2die4ever

  • Pre-Newbie
  • Posts: 1
    • View Profile
Re: [Mod] Auto image resize on upload. (updated 19/09/04)
« Reply #347 on: September 25, 2008, 12:39:45 AM »
I tried this mod in combination with
http://www.4homepages.de/forum/index.php?topic=20496.0
and it works just great on version 1.7.6

... thanks for your statement ... ;)

Hmmm......
schon komisch..
Ich verstehe immer noch nicht, wie die meisten es geschafft haben, diesen Mod auf 1.7.6 zu installieren...

Ich hab ein frisch installiertes 1.7.6  und ich finde weder den Inhalt der member.php noch
ist die /includes/upload.php geschweige denn die anderen Sachen auf meinem Server vorhanden :(

Ich weiß zwar, das es nur fuer die 1.7 - 1.7.4 Versionen geschrieben ist, aber dann versteh ich nicht, wie einige es geschafft
haben, auf 1.7.6 zu updaten....




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: [Mod] Auto image resize on upload. (updated 19/09/04)
« Reply #348 on: September 25, 2008, 12:57:23 AM »
Hello and welcome to 4images forum.

I just checked on v1.7.6 and found each string from each step without problem.
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 alekinna

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
    • Gallery of cross-stitching
Re: [Mod] Auto image resize on upload. (updated 19/09/04)
« Reply #349 on: October 07, 2008, 04:27:52 AM »
Hi all,
One more great and usefull mod. Work perfect!!

I had only one problem:
If images_validate=true, images was resaized but no 'big' folder was created and original file not saved.

So I did some manipulations:
in file member.php find
Code: [Select]
//-----------------------------------------------------------
//----------------------- Auto Image Resizing --------------
//----------------------------------------------------------
if ($config['auto_image'] && !$uploaderror) {
$src_copy = MEDIA_PATH."/".$cat_id."/big";
if ($direct_upload) {
$src = MEDIA_PATH."/".$cat_id."/".$new_name;
$src_copy = MEDIA_PATH."/".$cat_id."/big";
}
else {
$src = MEDIA_TEMP_PATH."/".$new_name;
}

replace with:
Code: [Select]
//-----------------------------------------------------------
//----------------------- Auto Image Resizing --------------
//----------------------------------------------------------
if ($config['auto_image'] && !$uploaderror) {
$src_copy = MEDIA_PATH."/".$cat_id."/big";
if ($direct_upload) {
$src = MEDIA_PATH."/".$cat_id."/".$new_name;
$src_copy = MEDIA_PATH."/".$cat_id."/big";
}
else {
$src = MEDIA_TEMP_PATH."/".$new_name;
$src_copy = MEDIA_TEMP_PATH."/big";
}

in file admin/admin_functions.php find:
Code: [Select]
function copy_thumbnail($image_media_file, $image_thumb_file, $from_cat = 0, $to_cat = 0) {
Insert above:
Code: [Select]
function copy_big($image_media_file, $image_big_file, $from_cat = 0, $to_cat = 0) {
if (is_remote($image_big_file)) {
return $image_big_file
}
$image_src_big = (($from_cat != -1) ? MEDIA_PATH.(($from_cat != 0) ? "/".$from_cat : "") : MEDIA_TEMP_PATH)."/big";
$image_dest_big = (($to_cat != -1) ? MEDIA_PATH.(($to_cat != 0) ? "/".$to_cat : "") : MEDIA_TEMP_PATH)."/big";
$image_src_file_big = $image_src_big."/".$image_media_file;
if ($image_big_file != "" && file_exists($image_src_big."/".$image_big_file)) {
if (!@is_dir($image_dest_big)) {
$oldumask = umask(0);
$result = @mkdir($image_dest_big);
umask($oldumask);
if (!@is_dir($image_dest_big) || !$result) {
@mkdir($image_dest_big, CHMOD_DIRS);
}
}
$big_extension = get_file_extension($image_big_file);
$new_big = get_file_name($image_media_file).".".$big_extension;
if (file_exists($image_dest_big."/".$new_big)) {
unlink($image_dest_big."/".$new_big);
}
$ok = copy($image_src_big."/".$image_big_file, $image_dest_big."/".$new_big);
if ($ok) {
@unlink($image_src_file_big);
@chmod($image_dest_big."/".$new_big, CHMOD_FILES);
$image_big_file = $new_big;
}
if (!file_exists($image_dest_big."/".$new_big)) {
if (!copy($image_src_file_big, $image_dest_big."/".$new_big)) {
$error_log[] = sprintf($lang['copy_file_error_perm'], $image_src_file_big, $image_dest_big."/".$new_big);
}
}
}
return $image_big_file;
}

In file admin/validateimages/php find:
Code: [Select]
$old_thumb_path = THUMB_TEMP_PATH."/".$image_thumb_file;
Insert below:
Code: [Select]
if (file_exists( MEDIA_TEMP_PATH."/big/".$image_media_file ) ) { //  Проверяем есть ли ориг. файл
$image_big_file = addslashes($image_cache[$key]['image_media_file']);
$old_big_path = MEDIA_TEMP_PATH."/big/".$image_big_file;
}

Find:
Code: [Select]
$new_thumb_name = copy_thumbnail($new_name, $image_thumb_file, "-1", $cat_id);
Insert below:
Code: [Select]
if ($old_big_path) {
$new_big_name = copy_big($new_name, $image_big_file, "-1", $cat_id);
}

Find:
Code: [Select]
@unlink($old_thumb_path);
Insert below:
Code: [Select]
if ($old_big_path) {
@unlink($old_big_path);
}


May be it's not right way to solve this problem, but it's work for me.

V@no, thank you for this mod!

Offline rubberduck

  • Jr. Member
  • **
  • Posts: 91
    • View Profile
    • Reptilienmanager.de
Re: [Mod] Auto image resize on upload. (updated 19/09/04)
« Reply #350 on: October 09, 2008, 01:39:14 PM »
admin/images.php
Search for:
Code: [Select]
if (@unlink(MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file'])) {
Replace with:
Code: [Select]
if (@unlink(MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file']) &&
            @unlink(MEDIA_PATH."/".$image_row['cat_id']."/big/".$image_row['image_media_file'])) {

This will also delete the big image from your server when you delete an image in the ACP.
Else you just delete the small file.

Könnt Ihr vieleicht das obige an diesen Post

http://www.4homepages.de/forum/index.php?topic=7700.msg22313#msg22313

mit dranhängen? Erspart ne Menge Zeit beim Suchen und man würde es dann auch über das TUT vom Mawenzi gleich finden.

ReptilienManager.de - Die Online Reptilien Verwaltung
Neueinsteiger.eu - Das Portal für Terraristik Einsteiger
Terra-ROW.de - Der regionale Terraristik Stammtisch in Rotenburg

Offline deadlydozen

  • Pre-Newbie
  • Posts: 8
    • View Profile
Re: [Mod] Auto image resize on upload. (updated 19/09/04)
« Reply #351 on: October 11, 2008, 06:41:46 PM »
Hallo,

gibt es eine Möglichkeit das bei dem "Auto copy original file to /big/ folder" Modifikation alle Bilder in den big Folder gespeichert werden ?

Die Modifikation klappt so weit ganz gut. Bis auf eine Sache. Ich habe im ACP das Format 600 * 450 px gewählt.

Wird jetzt vom User ein Bild 1024 * 768 hoch geladen wird es ja auch 600 * 450 verkleinert und in dem media/1 Ordner gespeichert. Das 1024 * 768 wird im Big Ordner abgelegt.

Lade ich jetzt aber ein 400 * 300 px  Bild hoch wird es nur im media/1 Ordner gespeichert und nicht im Big Ordner.

Gibt es eine Möglichkeit das jedes Bild in den Big Ordner geladen wird, unabhängig davon ob es verkleinert wurde oder nicht ?

lg
Michael

Offline External

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: [Mod] Auto image resize on upload. (updated 19/09/04)
« Reply #352 on: October 28, 2008, 12:22:46 PM »
I must be blind, but i dont see any "resized image width field in admin...i see only following options:

Auto-resize image  Yes    No

Auto-resize image quality

Auto-create thumbnail Yes    No

Thumbnail size in pixel

Where do I set the resized width to i.g. 732 pixels?

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: [Mod] Auto image resize on upload. (updated 19/09/04)
« Reply #353 on: October 28, 2008, 01:35:22 PM »
It is under "Upload settings" category:

Max. image width in pixel
   
Max. image heigth in pixel
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 webtrade

  • Pre-Newbie
  • Posts: 9
    • View Profile
Re: [Mod] Auto image resize on upload. (updated 19/09/04)
« Reply #354 on: November 30, 2008, 10:15:49 AM »
Hi,

Just wanted to check if this post is still valid and if it's required for 1.7.6 and if it's the the best and easiest way to automatically resize photos upon upload? Also I'm unable to download the file mentioned in step 5. Does it still exist?

Hope someone can help?

Cheers



http://www.4homepages.de/forum/index.php?topic=7700.0

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: [Mod] Auto image resize on upload. (updated 19/09/04)
« Reply #355 on: November 30, 2008, 11:23:32 AM »
hi and welcome to the 4images forum,

post is still valid ;)

try this download link: http://www.4homepages.de/forum/index.php?action=dlattach;topic=7700.0;attach=874 (attached in the 1st post too) due V@no's site do not exist anymore
cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi

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: [Mod] Auto image resize on upload. (updated 19/09/04)
« Reply #356 on: November 30, 2008, 06:26:03 PM »
Wrong download link removed.
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 webtrade

  • Pre-Newbie
  • Posts: 9
    • View Profile
Re: [Mod] Auto image resize on upload. (updated 19/09/04)
« Reply #357 on: December 01, 2008, 06:59:25 AM »
Thanks Nicky. Much appreciated! :D

Offline jaromir

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: [Mod] Auto image resize on upload. (updated 19/09/04)
« Reply #358 on: December 05, 2008, 12:34:29 AM »
can be deleted!!
« Last Edit: December 05, 2008, 12:47:50 AM by jaromir »

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [Mod] Auto image resize on upload. (updated 19/09/04)
« Reply #359 on: December 05, 2008, 12:46:39 AM »
@jaromir

... this MOD resized images during the upload process via upload-form ...
... I think you tested auto resize via ACP, this MOD is not for the ACP ...
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...