News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Automatic Attachment Rotation (and Resize)

Started by dougiefresh, March 04, 2016, 07:34:59 PM

Previous topic - Next topic

GL700Wing

Quote from: The QE2 Story Forum on May 15, 2018, 09:04:01 AM
Hi.. Thanks.  It was at 128, I've tried 256 and 512 but it still does the same thing.  As soon as I turn off "automatically rotate" it lets it upload, and I can then still manually rotate it no problem (in fact it does it instantly)..
Have you tried adjusting the settings in the php.ini file for the forum?

These are the settings I'm using for the forum on the higher spec shared server:
memory_limit = 512M
post_max_size = 64M
upload_max_filesize = 64M

Life doesn't have to be perfect to be wonderful ...

GL700Wing

Quote from: The QE2 Story Forum on May 15, 2018, 10:41:04 AM
Also seeing this error lots of times, but only for guests :-

https://www.theqe2story.com/forum/index.php?topic=6455.0
8: Undefined variable: mp
File: /home/theqesto/public_html/forum/Sources/Class-exifReader.php
Line: 1201
I've never seen that error and I'm unable to reproduce it but if you make the following change to line 1201 of ./Sources/Class-exifReader.php it should fix the problem:

Find:
$this->ImageInfo['h']["customRendered"] = ($mp == 0) ? 'Normal Process' : ($mp == 1 ? 'Custom Process' : 'Reserved');

Replace With:
$this->ImageInfo['h']["customRendered"] = (!isset($mp) || $mp == 0) ? 'Normal Process' : ($mp == 1 ? 'Custom Process' : 'Reserved');

The change basically makes 'Normal Process' the default value (and this is actually the default value for "customRendered") if '$mp" has not already been defined.

If you can test/confirm this fix I'll include it in the next version.

Life doesn't have to be perfect to be wonderful ...

Rob Lightbody

HI there,

I did your suggested change a few hours ago, and am not seeing any errors now.

Cheers,

- Rob

GL700Wing

Quote from: The QE2 Story Forum on May 17, 2018, 06:04:19 PM
I did your suggested change a few hours ago, and am not seeing any errors now.
Thanks - I'll include this fix in the next update.

BTW - You can leave this fix in place until then as it won't generate any errors in relation to ./Sources/Class-exifReader.php when the current version of the mod is uninstalled as it deletes that file completely.
Life doesn't have to be perfect to be wonderful ...

dougiefresh

Uploaded v5.6 - May 21st, 2018
o Fixed undefined variable error in Class-exifReader.php.




Quote from: GL700Wing on May 16, 2018, 08:27:13 AM
Replace With:
$this->ImageInfo['h']["customRendered"] = (!isset($mp) || $mp == 0) ? 'Normal Process' : ($mp == 1 ? 'Custom Process' : 'Reserved');
I just looked at the code.  Nowhere else is the $mp variable used.  So it should probably read like this:
$this->ImageInfo['h']["customRendered"] = (empty($tmp) ? 'Normal Process' : ($tmp == 1 ? 'Custom Process' : 'Reserved'));
The empty function also catches if the variable isn't defined.  When your statement is replaced with my above code, this SHOULDN'T happen....

I've integrated this change into this version.  Hopefully, it'll help with the mod....  :P ::)

dan4ever


Hi


Still getting this error:
8: Undefined offset: 9
Fil: /home4/*****/forum/Sources/Display.php
Rad: 1339


Looks like this:
   list ($id_folder, $real_filename, $file_hash, $file_ext, $id_attach, $attachment_type, $mime_type, $is_approved, $id_member, $proper_rotation) = $smcFunc['db_fetch_row']($request);




Something work around maybe?
have 5.5 will upgrade soon


/Dan
/Dan Olsson, Webmaster at https://www.guldforum.se

GL700Wing

Quote from: dan4ever on June 09, 2018, 01:50:46 PM
Still getting this error:
8: Undefined offset: 9
Fil: /home4/*****/forum/Sources/Display.php
Rad: 1339

Looks like this:
   list ($id_folder, $real_filename, $file_hash, $file_ext, $id_attach, $attachment_type, $mime_type, $is_approved, $id_member, $proper_rotation) = $smcFunc['db_fetch_row']($request);

Does line 1325 (or a line very close to this number) in your ./Sources/Display.php look like this?
SELECT a.id_folder, a.filename, a.file_hash, a.fileext, a.id_attach, a.attachment_type, a.mime_type, a.approved, m.id_member, a.proper_rotation
Life doesn't have to be perfect to be wonderful ...

dan4ever

#207

Yes!

SELECT a.id_folder, a.filename, a.file_hash, a.fileext, a.id_attach, a.attachment_type, a.mime_type, a.approved, m.id_member, a.proper_rotation


/Dan
/Dan Olsson, Webmaster at https://www.guldforum.se

GL700Wing

Quote from: dan4ever on June 10, 2018, 07:31:15 AM
Yes!
Ok - we'll I don't know why those errors are being generated on your forum.  However, given this issue has not been reported previously you could try uninstalling the version you currently have installed (making to sure to fix any uninstall errors) and then install the latest version.
Life doesn't have to be perfect to be wonderful ...

dougiefresh

Uploaded v5.7 - October 10th, 2018
o No functionality change.
o Updated documentation to point to new website.




@dan4ever:  Sorry to reply so late after your bug report, but did upgrading to v5.6 solve your issue?

TourFL

Hello!

I just installed the mod and it seems to work very well. All my forums members (and me) are very grateful for that evolution ;D

But I get followings errors in my logs since I installed:

8: Undefined index: thumb_hash
File: /xxx/web/Sources/Display.php
Line: 1762

8: Undefined index: thumb_folder
File: /xxx/web/Sources/Display.php
Line: 1762

8: Undefined index: thumb_name
File: /xxx/web/Sources/Display.php
Line: 1762

Apparently, it is generated when I post a new picture. Any idea what could cause this?

Thanks a lot!
If you like Fiat 500 and derived models, the SMF forum I'm helping with: www.500-126.com

TourFL

Update:
Errors are not created only with the posting of images, but also viewing some pages with attached images (didn't find out yet what kind).
So I get 100+ errors relative to that mod everyday  :(

Here is the problematic code (line 1762 is at the getAttachmentFilename call):


        // A proper thumb doesn't exist yet? Create one!
                        if (empty($attachment['id_thumb']) || $attachment['thumb_width'] > $modSettings['attachmentThumbWidth'] || $attachment['thumb_height'] > $modSettings['attachmentThumbHeight'] || ($attachment['thumb_width'] < $modSettings['attachmentThumbWidth'] && $attachment['thumb_height'] < $modSettings['attachmentThumbHeight']))
                         {
                            [....]
                          }
else
    ========>       $thumb_realname = getAttachmentFilename($attachment['thumb_name'], $attachment['id_thumb'], $attachment['thumb_folder'], false, $attachment['thumb_hash']);

// Get timestamp for thumbnail image:
$time = !empty($thumb_realname) && file_exists($thumb_realname) ? filemtime($thumb_realname) : false;


I'm not sure if a previous installation of the mod didn't uninstall well and messed up the file.
Could anybody post how the code should look like in this part of the file? I run with SMT 2.0.15

Thanks in advance for any help!
If you like Fiat 500 and derived models, the SMF forum I'm helping with: www.500-126.com

dougiefresh

@TourFL:  Can you attach your Sources/Display.php so that I can see what is going on here?

dougiefresh

@TourFL:  Never mind, I see what is happening.....  Let me fix the issue....

Denny O

Dougiefresh,

I know you are busy with all that you do here and about life in general, is the new version about ready to come out?
I'm recently appointed the Admin for our website using SMF 2.0.15 | SMF © 2017, Simple Machines XHTML RSS WAP2

My people need a way to post pics that is stupid proof for old fishermen that have no tech savvy. This seems to be the ticket, isit?

I would like to upload this to our site sometime soon as this is a slower time for posting traffic due to the change between soft water and not quite yet hard water.

I will await your response before I up load the latest version of this mod.

Thanks for your work!
Denny O
Hook'in Walleyes while Watch'in my Hawkeyes!

petewadey

First of all, thanks for a great mod.
A couple of questions
1. Even though I have the "Keep backup of original image file when resizing" box unchecked, I'm getting a new attachments folder, preREI in my file manager. Is this normal? I wasn't expecting to see that.
2. In my original attachment file, a lot of attachments are duplicated with temp, or tmp after the name. I can't say I noticed it before using the mod, so not saying it has anything to do with it, just asking. If it is this mod, is it ok to delete one or the other, as the size of my attachment file has almost doubled.
Thanks
Pete

TourFL

Hello Dougiefresh!
Any news on the problem with the error logs? I can still send you my Display.php if it helps  ;)

Thanks!
If you like Fiat 500 and derived models, the SMF forum I'm helping with: www.500-126.com

landyvlad

Is the mod 2.1 RC1 compatible?

I assume it is BUT i want to be sure before proceeding. Thanks.
"Put as much effort into your question as you'd expect someone to give in an answer"

Please do not PM, IM or Email me with questions on astrophysics or theology.  You will get better and faster responses by asking homeless people in the street. Thank you.

Be the person your dog thinks you are.

dougiefresh

Uploaded v5.8 - June 22nd, 2019
o Added support for SMF 2.1 RC2.
o Removed support for SMF 2.1 Beta 3.
o SMF 2.0: Fixed undefined index errors in Sources/Display.php.




@TourFL: I think this version should fix the error(s) you reported back a while ago.  Apologees about the length of time between your report and this version's release.  Please let me know if this version fixes the issues you found.  Thanks!

@Denny O:  Apologees about the length of time between your inguiry and this version's release.  This SHOULD work.  Please let me know if you find anything with this version.  Thanks!

@petewadey:  You're welcome.  Off the top of my head, I don't know the answers to the questions being posed, as I was minimally involved in the 5.x series of this mod.  I will endeavor to get you an answer to your questions ASAP!

@landyvlad:  It never safe to assume that any mod that works without issue on a previous beta or RC will work with the next version of SMF.  I missed the RC1 release, and making each mod compatible with it.  However, as of this version, this mod is compatible with RC2.  I hope this helps you.

dougiefresh

@landyvlad:  I just want to add that once SMF 2.1 goes gold, mods will generally work with minimal modification between versions.  What I mean is mods written for 2.1 SHOULD work on 2.1.1, but it is never safe to assume something written for 2.1 Betas will work on RCs, or on Gold. 

Most of my mods haven't required much modification between these versions, but some require major help to get them to work properly.  Pure hook-based mods sometimes require zero effort to make work in RC2.

I'm also finding that functions that worked in SMF 2.1 Beta 3 work slightly different in RC2 (which added to my fustration until I realized what was happening, and then fustration until I figured out how to make it work as expected)....

Advertisement: