Jump to content


Photo

Suggestion - Resize article image functionality


  • Please log in to reply
13 replies to this topic

#1 SubStrider

SubStrider

    Advanced Member

  • +Clients
  • 269 posts

Posted 29 November 2011 - 01:22 AM

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

#2 gxgEric

gxgEric

    IPB Full Member

  • +Clients
  • 194 posts

Posted 02 December 2011 - 02:04 PM

Yes, this is a must! Please integrate timthumb somehow.
my ips powered website: http://www.genxglow.com/

#3 arikbo

arikbo

    Advanced Member

  • +Clients
  • 204 posts

Posted 02 December 2011 - 02:30 PM

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

#4 SubStrider

SubStrider

    Advanced Member

  • +Clients
  • 269 posts

Posted 02 December 2011 - 11:46 PM

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

Interesting! Can you please tell me how did you achieve that? Where did you place the timthumb file and what lines did you enter in which template to include timthumb functionality.

#5 arikbo

arikbo

    Advanced Member

  • +Clients
  • 204 posts

Posted 03 December 2011 - 06:14 AM

Sure

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.


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

This is the code I put in my custom article view template.
<if test="$data['record']['article_image']">
<img class='photo left ipsPad' src="/thumbnails/timthumb.php?src={$data['record']['article_image']}&w=225">
</if>

Of course you can change your width & height to whatever works for you. I'm using timthumb for front pages, blocks & databases too.
  • zoeker, m3rk0rd, Marcher Technologies and 1 other like this

#6 Marcher Technologies

Marcher Technologies

    $life=FALSE;$code=TRUE;$time--;

  • +Clients
  • 11,745 posts

Posted 03 December 2011 - 08:01 AM

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.

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

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.

#7 arikbo

arikbo

    Advanced Member

  • +Clients
  • 204 posts

Posted 03 December 2011 - 09:13 AM

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/

#8 Marcher Technologies

Marcher Technologies

    $life=FALSE;$code=TRUE;$time--;

  • +Clients
  • 11,745 posts

Posted 03 December 2011 - 09:15 AM

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 >.<

#9 arikbo

arikbo

    Advanced Member

  • +Clients
  • 204 posts

Posted 03 December 2011 - 09:20 AM

I don't give back kisses. :logik:

... 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. ;)

#10 Marcher Technologies

Marcher Technologies

    $life=FALSE;$code=TRUE;$time--;

  • +Clients
  • 11,745 posts

Posted 03 December 2011 - 09:23 AM

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.

#11 SubStrider

SubStrider

    Advanced Member

  • +Clients
  • 269 posts

Posted 03 December 2011 - 04:39 PM

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?

#12 mat206

mat206

    Advanced Member

  • +Clients
  • 438 posts

Posted 04 December 2011 - 12:10 PM

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.inv...submission-r511
  • zoeker likes this

#13 Jinkler

Jinkler

    Needs Serious Help

  • +Clients
  • 1,637 posts

Posted 19 October 2013 - 10:00 AM

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?


TalkFord.com - Independent, Unbiased, Ford News, Reviews And Advice. Download The Free TF App - Apple ¦ Android

 

DaciaForum.co.uk - The UK's number 1 Dacia forum! Download The Free DF App - Apple ¦ Android

 

SmartWatchForum.com - Smart Watch Reviews, News and Forums. Which one will you buy? Download the Free SWF App - Android ¦ Apple Coming soon...


#14 Jinkler

Jinkler

    Needs Serious Help

  • +Clients
  • 1,637 posts

Posted 19 October 2013 - 12:19 PM

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


TalkFord.com - Independent, Unbiased, Ford News, Reviews And Advice. Download The Free TF App - Apple ¦ Android

 

DaciaForum.co.uk - The UK's number 1 Dacia forum! Download The Free DF App - Apple ¦ Android

 

SmartWatchForum.com - Smart Watch Reviews, News and Forums. Which one will you buy? Download the Free SWF App - Android ¦ Apple Coming soon...





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users