News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Resize Attached Images (Updated for 2.0 RC4)

Started by Kays, October 17, 2009, 04:19:10 PM

Previous topic - Next topic

Kays

Sorry, I'm not online that much lately.

Which version SMF?

Do you have any other attachment related mods installed?

Any errors in the error log?

Can you post an copy of your phpinfo file. What is a phpinfo() file?

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

kennethm

smf 2.0.2

no other attachment relate mods installed

no errors in error log

only installed mod is the ad mod

I would really like to use your mod but something went astray. P tell me with my version of smf is there something else i needed to do other than just install it the conventional way? tweak some code, etc?

Kays

No, it should work as long as you imput some values for it.

Just saw your other thread and I'm wondering if some of your problems are server related timeouts. To check that, it would be nice to see your phpinfo file.

http://wiki.simplemachines.org/smf/What_is_a_phpinfo()_file

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

kennethm

<?php phpinfo();Â ?>

folloing the instructions to create that page, once uploaded and looked at in the browser, the above is whats displayed in the page, So whats this mean? If my server doesnt run php then how have i had a working forum for a month until i installed the resize attachment mod?

Howard43Willard

Hi, this mod is for those who wish to cut down on server space. So it does permanently resize all attached images.




Kays

Quote from: kennethm on December 02, 2012, 10:51:50 PM
<?php phpinfo();Â ?>

folloing the instructions to create that page, once uploaded and looked at in the browser, the above is whats displayed in the page, So whats this mean? If my server doesnt run php then how have i had a working forum for a month until i installed the resize attachment mod?

Your server does support php since SMF requires that it be installed.

The contents should be <?php phpinfo(); ?>. Don't know where the "Â" came from or if it's messing things up.. Also the file extension needs to be .php.

Quote from: Howard43Willard on December 03, 2012, 03:07:47 AM
Hi, this mod is for those who wish to cut down on server space. So it does permanently resize all attached images.


Yes the resize is permanent.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

kennethm

what folder/place do you need that file uploaded to or does it matter

Kays

It doesn't matter. Either the root of your site or in the same folder your forum is in.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

kennethm

i make and save a php file, i copy and paste ONLY the text you said to include in the file, i upload to the server. I still get what i posted earlier?? Am i missing something or what is the problem?

Kays

Sorry, but I don't know what the problem there is.

All that I can suggest is that you go to the mod page, parse the mod and verify that all of the edits the mod makes were removed. Except for one file it's all well identified.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Rob Lightbody

Hello,

This Mod seems like just the thing to allow my SMF forum to compete with its Facebook rivals.  I can't understand why there aren't hundreds of excited posts in here about it?

My users, who are often fairly old and technically unskilled, MUST be able to upload any old photo or scan that they have, and let the server worry about resizing it for them.  Everything else I've tried has just confused them.

Is this Mod OK with 2.0.4. ?

Thanks,

- Rob

Rob Lightbody

#231
Quote from: kizer on February 25, 2011, 05:20:15 PM
I installed it in 2.0 RC 5 and this is what I get when I look at any of my Mod settings in the admin panel. It shows up in the header and it looks like some of my Div tags are wacked out because some of my settings appear to be shifted or simply look to have been erased. LOL


// Added for resize attached images mod 2.0. $helptxt['attachment_image_compression'] = 'This sets the JPEF quality factor. A higher number increases image quality but also increase the file size. '; $helptxt['attachment_resize_existing'] = 'Selecting this option will resize any existing images which are larger than the set dimensions for attached images.'; $helptxt['attachment_image_reformat'] = 'Selecting this option will reformat any non-JPEG images into the JPEG format';


I get this too - on 2.0.4.  It gave me a fright, so I uninstalled the mod until I could find out more.

Thanks to Kizer's earlier comments, I then discovered that it had put the text in admin.english.php in after the ?>  I corrected this, and it resolved the problem.

Rob Lightbody

Wow!

It works!  By eck it works!!

This functionality MUST be included in a future release of SMF, absolutely dynamite!

I just uploaded an 8mb digital camera photo (from a modern 14mp camera) and it was seamlessly shrunk down to a normal size.

Kays

Great, glad you got that sorted out. :)

Something like that occurs when the ?> is not on the last line. It can happen with with any mod.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

lc62003

This is a great mod!  But I am having an issue.  :-X

When old images get resized they no longer show.  If the link is clicked a 404 is produced.  The mod was installed on 2.0.5 now upgraded to 2.0.6.  The images appear to still be on the server.  I can download, add the .jpg and view them just fine.  They are indeed resized.  I can find the entry in the database as well.  I'm not sure what doesn't jive here.   :-[

Worth noting:  the forum does have two attachment folders as the original is quite large.  Not sure if that' related at all. 

How can I fix this?   :)


Kays

Hi, sorry about the delay. Not been online much lately.

I tried to replicate the problem but it seems to work for me. ???

In which folder are the problem files?

The files on the server how are they named? For any files added after 1.1.9 or 2.0 final the name should be the file id, an undescore (_) followed by the file hash. Check the database and see if this is correct for one of the problem files. Also in the database the folder id will be 1 for the original attachments folder and increments from there for each added folder. Check if that's correct.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

lc62003

Quote from: Kays on November 19, 2013, 06:39:10 PM
Not been online much lately.

Hope things are well for you.   ;)



Quote from: Kays on November 19, 2013, 06:39:10 PM

In which folder are the problem files?


The original folder is called attachments.  The new one is attachments2.  I can't say for certain this is exclusive as this affects many files but the problem attachments I've found reside in attachments. 


Quote from: Kays on November 19, 2013, 06:39:10 PM

The files on the server how are they named? For any files added after 1.1.9 or 2.0 final the name should be the file id, an undescore (_) followed by the file hash. Check the database and see if this is correct for one of the problem files.

Here is an example of a pic that doesn't work:   

in attachments:
117963_DSCF0958_JPG3497f7e437ffce635e7095e



Here is the corresponding database entry:

id_attach  id_thumb  id_msg    id_member  attachment_type      filename    size    downloads  width  height  approved  fileext  mime_type  id_folder  file_hash
117963       136432  1110539    0        0                      DSCF0958.jpg    56801    421         800    600        1              jpg    image/jpeg    3    



I'm not seeing a filehash database entry.  If I copy an paste the remainder of the filename after 'JPG' into the database it still does not work.  This is the hash or no? 
Also noting the database 'size' and filesize denoted by the server are different as well. 

(The hash I posted is incomplete......could that be a security risk to post it complete?)


Thanks!! 

Kays

It looks like that file is named using the old encryption method which doesn't use "file_hash" but rather a md5 hash of the file name.

Try changing the JPG to lowercase. "117963_DSCF0958_jpg3497f7e437ffce635e7095e"

Also it looks like the folder id is 3. Which folder is this file from?

I've got to look at the mod to see how it handles the old style of encryption.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

lc62003

Well it's a start!   :)  The filename change didn't fix it. 

Yeah, I'm not sure about the folder number.  Noticed that before too.  I'm not the original owner of this forum so who knows what folder swapping has occured.  Naturally it's been migrated several times as well.  I should have mentioned the age of this forum as well. 

The database contains folders 1, 2, and 3.  2 is apparently the avatar folder. 

Ideas for a next move?   :D

Advertisement: