Jump to content


Photo

Image Resizing Issue


  • Please log in to reply
6 replies to this topic

#1 everfreecreative

everfreecreative

    Sr. Member

  • Members
  • PipPipPipPip
  • 110 posts
  • 43

  • LocationCT, USA

Posted 26 March 2012 - 01:13 PM

I'm trying to set a max-width of 300px on the image field for images uploaded on the backend. However, when I try uploading a 900px wide image, I just get the image at the original width with greater pixelation.

It's not being resized in the browser with html or css, since when I download the image it's still 900px wide. What's going on?

#2 Marty Walker

Marty Walker

    Sr. Member

  • Members
  • PipPipPipPip
  • 335 posts
  • 155

  • LocationKatoomba, AU

Posted 26 March 2012 - 02:19 PM

Can you post your PW template and CSS code?

#3 everfreecreative

everfreecreative

    Sr. Member

  • Members
  • PipPipPipPip
  • 110 posts
  • 43

  • LocationCT, USA

Posted 26 March 2012 - 07:42 PM

I'm using this gallery template file: http://processwire.c...__fromsearch__1

The CSS definitely isn't the problem, as I downloaded the image to check it out and it is, indeed, 900px wide (but looks like a 300px image blown up to 900px wide).

#4 Soma

Soma

    Hero Member

  • Moderators
  • 3,205 posts
  • 1757

  • LocationSH, Switzerland

Posted 27 March 2012 - 12:43 AM

if you set the image to be max width 300px (it will scale bigger picture uploaded to 300px), then in the template there's (form that code)

$nextImage = $image->getNext();
$prevImage = $image->getPrev();
$sizedImage = $image->size(900);

So it will get upscaled to 900px.

@somartist | modules created | support me, flattr my work flattr.com


#5 Pete

Pete

    Administrator

  • Administrators
  • 1,756 posts
  • 658

  • LocationChester, England

Posted 27 March 2012 - 01:13 AM

Yup - you need to check in your template what size the image already is using $image->width() and $image->height() if you don't want things to be blown up by the $image->size() code in the template.

#6 diogo

diogo

    Hero Member

  • Moderators
  • 2,008 posts
  • 1089

  • LocationPorto, Portugal

Posted 27 March 2012 - 03:47 AM

would be very nice to have a max-size(900)

#7 everfreecreative

everfreecreative

    Sr. Member

  • Members
  • PipPipPipPip
  • 110 posts
  • 43

  • LocationCT, USA

Posted 27 March 2012 - 08:06 AM

Whoops, that should have been an easy one to spot. Thanks guys!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users