Forums


Marketplace (en)

Forum for Marketplace, a Joomla! 1.0 classified ads component. Posts in english language.
Public write access is disabled. Please login or register
Last post
Forums  » Marketplace (en)  » Maximum height or width for images?
chrisjclay

chrisjclay
5 posts
---
Location:
n.a.
20.08.2009 00:49

Maximum height or width for images?

Hi,

I know how to specify a maximum file size for an image. However, some people are uploading small image files that are still too big - has anyone come up with a way to specify the maximum height / width for an image, or even better, have images automatically re-sized if they're too high or wide?

Thanks for any help!

Chris




chrisjclay

chrisjclay
5 posts
---
Location:
n.a.
16.09.2009 18:33
Re: Maximum height or width for images?
Anyone? A realtor just created a bunch of ads and used photos straight from her digital camera (i.e. resolution around 3000x2000). This caused Marketplace to spew out this error:

Fatal error: Out of memory (allocated 63700992) (tried to allocate 12288 bytes) in /home/slba/public_html/components/com_marketplace/show_ad.php on line 456

I had to manually resize all of the photos in Photoshop and upload them back to the site....

I love Marketplace, but this one problem is a pretty major one. Does anyone know how the component can automatically re-size the images, or at least check the size and warn the user they're too big?




mrwitherkay

mrwitherkay
6 posts
---
Location:
n.a.
19.10.2009 16:19
Re: Maximum height or width for images?
I understand what you mean as I too would like to be able to have images automatically resized as many people do not know what all the fuss is about and assume uplaoding large images is mormal and will automatically be corrected back end without even thinking about it.

It is a problem for be so much that I have taken the option of my visitors viewing a larger image of the thumbnail as the whole idea of images being uploaded is so that I do not have to resise them myself which is what I used to do before and it becomes too time consuming along with all the other back end jobs that have to be done.

I think it's a shame that such a simple function (though probably not simple in the coding of course) is not already an integral part of this component and I hope someone can figure out how to auto resize the viewable images as it will help a lot.




markayling

markayling
3 posts
---
Location:
West Sussex
United Kingdom
10.11.2009 10:22
Re: Maximum height or width for images?
Hi There

I am also having this problem and I'm desperate to find a solution!

Anyone have any further info...?

Thanks in advance,

Mark.




markayling

markayling
3 posts
---
Location:
West Sussex
United Kingdom
10.11.2009 10:59
Re: Maximum height or width for images?
Hello again

I have actually managed to get around this with a small tweak to the code...

Around line 456 of show_ad.php (where it is falling over) is this:

-----------
$img = ImageCreateFromJpeg( $mosConfig_absolute_path."/components/com_marketplace/images/entries/".$ad_id.$c.".jpg");
$img_width = ImageSx( $img);
$img_height = ImageSy( $img);
-----------

This is loading up the whole full-sized image into memory, just to get the dimensions to pass to the popup window function later.

I replaced that code with this:

-----------
//$img = ImageCreateFromJpeg($mosConfig_absolute_path."/components/com_marketplace/images/entries/".$ad_id.$c.".jpg");
//$img_width = ImageSx( $img);
//$img_height = ImageSy( $img);

//MPA - get image dimensions this way to prevent memory error
$imginfo = getimagesize($mosConfig_absolute_path."/components/com_marketplace/images/entries/".$ad_id.$c.".jpg");
$img_width = $imginfo[0];
$img_height = $imginfo[1];
-----------

This gets the dimensions without loading the image up and gets rid of the out of memory error. You'll have to repeat the above for the other image types, PNG and GIF, hopefully that is self explanatory though.

Whilst this gets rid of the error, it would be great if Marketplace could scale/compress images when they are uploaded, not just to save space but also so that the popup is not too massive on screen. I will have a stab at it shortly and see if I can work it out.

Any assistance from CodingFish would be appreciated...

Fantastic product by the way!

Cheers,

Mark.




lateralus

lateralus
14 posts
---
Location:
n.a.
30.05.2010 18:07
Re: Maximum height or width for images?
Hi,

thanks for the trick, it sounds very nice ;)

But I have a problem with your trick!
As I choose to use 3 images in the config of MP, I have this kind of code (with the letters a & b &c)
I tried my tricks but it's not working!
Any idea??

Thanks

Ludo

-----------------MY ORIGINAL CODE--------------
$a_piclink = $mosConfig_live_site."/components/com_marketplace/images/entries/".$ad_id."a.jpg";
$a_img = ImageCreateFromJpeg( $mosConfig_absolute_path."/components/com_marketplace/images/entries/".$ad_id."a.jpg");
$a_img_width = ImageSx( $a_img);
$a_img_height = ImageSy( $a_img);

-----------------MY TRICK--------------
$a_piclink = $mosConfig_live_site."/components/com_marketplace/images/entries/".$ad_id."a.jpg";
//MPA - get image dimensions this way to prevent memory error
$a_imginfo = getimagesize($mosConfig_absolute_path."/components/com_marketplace/images/entries/".$ad_id.$a.".jpg");
$a_img_width = $a_imginfo[0];
$a_img_height = $a_imginfo[1];




Forums  » Marketplace (en)  » Maximum height or width for images?
Discussions v1.1
(c) 2010 Codingfish

Login