Suggestion - Resize article image functionality

14 posts in this topic

Posted

When creating an article there is an option to upload an image. This field -> Article Image Single File Uploads

Now currently I can upload a 5MB image of insane dimensions and the system will not resize it. To show the thumbnail on the front page it uses the same dimension of the image and resizes it using CSS.

This is a very crude way of doing it as a visitor who is opening the category page or article will need to download the entire 5MB file of insane dimensions just to be able to see a thumbnail of say 150px on category page and a thumbnail of 300px on the article page.

It is easier to set a process around it and instruct the users to not upload a huge image but it would be far better to build these basics into the system itself.

zoeker and Jinkler like this

Share this post


Link to post
Share on other sites

Posted

Yes, this is a must! Please integrate timthumb somehow.

Share this post


Link to post
Share on other sites

Posted

I'm using timthumb with it now because of that reason.

Share this post


Link to post
Share on other sites

Posted

[quote name='arikbo' timestamp='1322854243' post='2203726']
I'm using timthumb with it now because of that reason.

Share this post


Link to post
Share on other sites

Posted

Sure



I created a folder in the root of my server called "thumbnails".

This is the code I put in my custom article view template.


Of course you can change your width & height to whatever works for you. I'm using timthumb for front pages, blocks & databases too.

Getting TimThumb to work is pretty straight forward. You need the php file, which you can download TimThumb from Google code, placed in a folder on your website. In the same directory as the timthumb.php file you need to add 2 directories. The two directories are 'cache' and 'temp', and both need to have their file permissions set to 775.


<if test="$data['record']['article_image']">

<img class='photo left ipsPad' src="/thumbnails/timthumb.php?src={$data['record']['article_image']}&w=225">

</if>

m3rk0rd, SubStrider, zoeker and 1 other like this

Share this post


Link to post
Share on other sites

Posted

[quote name='arikbo' timestamp='1322910872' post='2203998']
Sure



I created a folder in the root of my server called "thumbnails".

This is the code I put in my custom article view template.


Of course you can change your width & height to whatever works for you. I'm using timthumb for front pages, blocks & databases too.

Arikbo, i could kiss you right now, i think your bit of simplistic third-party fix may be a personal answer for me.


<if test="$data['record']['article_image']">

<img class='photo left ipsPad' src="/thumbnails/timthumb.php?src={$data['record']['article_image']}&w=225">

</if>

Share this post


Link to post
Share on other sites

Posted

[quote name='arikbo' timestamp='1322921617' post='2204051']
Aw, thank you! :kiss:

But to be honest you'll have to pucker up to Grumpy who gave me the idea when I was desperate for a fix.

http://community.inv...ails-in-blocks/

... I believe i spoke too soon >.< the requirements for web-shots on tim-thumb are far to strict......
I need to nab a preview image for videos via webshot >.<

Share this post


Link to post
Share on other sites

Posted

I don't give back kisses. :logik:

[quote name='Marcher Technologies' timestamp='1322921707' post='2204052']
... I believe i spoke too soon >.< the requirements for web-shots on tim-thumb are far to strict......
I need to nab a preview image for videos via webshot >.<


far too strict? What do you mean? I am planning on combining a blog directory on my site soon that will pull a screenshot... to be honest I'm not sure what all timthumb can do but I was hoping you could find out and I could pick your brain later. ;)

Share this post


Link to post
Share on other sites

Posted

[quote name='arikbo' timestamp='1322922024' post='2204053']
I don't give back kisses. :logik:



far too strict? What do you mean? I am planning on combining a blog directory on my site soon that will pull a screenshot... to be honest I'm not sure what all timthumb can do but I was hoping you could find out and I could pick your brain later. :wink:

I mean it requires php root to allow webshots, which makes it basically useless prepackaged...
that, and its "Whitelist" of web-shottable urls is 4 domains....
saddest part is i only need it to webshot the domain its ACTUALLY being run on.

Share this post


Link to post
Share on other sites

Posted

Somehow the page just keeps loading but the images don't appear. I think I am missing something. Is there any prerequisite for this to work?

Share this post


Link to post
Share on other sites

Posted

Just add an IPC hook for this - I'm sure you could package this into a separate hook that will do this automatically for you if you overload the class that saves forms.

Requires Imagick extension instead of GD though:

http://community.invisionpower.com/resources/articles.html/_/ipcontent/howto-resize-upload-field-images-on-record-submission-r511

zoeker likes this

Share this post


Link to post
Share on other sites

Posted

Wish I had come across this topic earlier, have been looking for a solution to this problem for ages!

 

Anyway, gone to try this out, and it's not working for me. This is what I'm using:

<img src="/thumbnails/timthumb.php?src=/uploads/{$record['field_205']}" />

I just get an image not found error.

 

Is there something wrong with my code above, or should I be looking elsewhere for the problem?

Share this post


Link to post
Share on other sites

Posted

Never mind, fixed, was a folder permission issue :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Who's Browsing   0 members

    No registered users viewing this page.