Jump to content

Why convert everything to JPG?


Recommended Posts

This is terrible.

Why does Presta convert every image to JPG??
I am working hard at creating nice looking PNGs or GIFs (becuase of IE), and when I put the files in the cart, they are rendered as medium quality JPGs.

Specifically, I am talking about the Home Text module and the shop logo.
What if I need transparency?

Link to comment
Share on other sites

Hi,

You must have a config problem in your administration zone .. I use PNG's JPG AND GIF's even animated ones !!
everything works ... look www.afrique-bijoux.com


David

TRANSPARENCY is done in the CSS (global.css) BUT by hand ... (with FIREFOX and FIREBUG)

Link to comment
Share on other sites

I am talking about header images.

I go to Preferences -> Appearance
Then I upload GIF as logo.
Then Presta converts it to JPG

I had to go inside some header.tpl file and change the HARDCODED call to "logo.jpg" to "logo.gif" and copy the file by hand to its location.

As far as I could see, this was a bad design call. Plain and simple.

Maybe for products you are right, I havent tested, but for header images this does not seem to be the case.

Anyways, thanks for sharing David.

Link to comment
Share on other sites

Hi again...
The conversion is due to the JAVAscript included in the soft ... I also used the ''BY HAND'' method in the TPL...

:-)
On my site I worked 5 hrs before finding the solution for the background I then MANUALY took off the LOGO.jpg and left it just with the page background ...

Bye from DAKAR :coolsmile:

Link to comment
Share on other sites

Hi,

You must have a config problem in your administration zone .. I use PNG's JPG AND GIF's even animated ones !!
everything works ... look www.afrique-bijoux.com



nice shop netchip! so you mean we can upload different file types? My JPEGs got resized down to certain limit... Where do we configure to let it be in better quality/size? Thx!
Link to comment
Share on other sites

Hi,

I do know that the way I do it is not realy very 'technic' but it works so this is the ''method'' :
I use Firefox with FIREBUG loaded ..
This enables seeing the real php rendered page eg. index.php (in the Firefox browser) with Firebug you can see ''live'' every single thing that makes up the page, including where they are !
Very often all the images are in ....themes\prestashop\img if you are using the prestashop theme from the start.
I then save the original image somewhere (never know) and replace it with mine (if you change the name you will have to re-write the same name in the css file.
And thats about it.
My background image is 980 x 1497 px ... (done with coreldraw 12 PSP and photoshop ) and it stays the same size..
As I did already say if you download in the administration pages the JAVAscript will resize, but if you do it this way the java is not used ...


Regards

DAVID
;-)

Link to comment
Share on other sites

Hey David,

What do you mean with firebug you can see "live" where everything is?
You mean the Inspect function? Where you hover over a piece of HTML in the browser and you see its code in firebug?
Or something else?

Link to comment
Share on other sites

Hi,

I mean that with FIREFOX as your browser with the optional FIREBUG loaded you open the prestashop page (I do it on my local server and send to my site after) so that gives me http:\\localhost ... Its the index.php that loads with all the included php pages ..
Using FIREBUG you can show any single thing that makes up what you are looking at sizes, filenames, where they are etc etc etc ...
Still using FIREBUG you can then EDIT the css GLOBAL.CSS and the changes are instantly made to the page ........ (ON LIVE)

David :coolsmile:

Link to comment
Share on other sites

This JPEG business is really starting to get on my nerves.
JPEG is a terrible choice, now when we have lossless PNG.

Even when I create JPG images for my categories, at the exact needed size, the Presta import system resamples them at a low quality. Nice smooth gradients, get JPG "stains" all over them.

Does anyone know if there is any configuration I can do to make it use 100% quality JPG? Maybe some arguments to the PHP resize function? I dont mind modifying it even if its inside the PHP.
I wish to maintain the highest possible quality for Homepage image and Category images

For homepage, I just replaced my own 100% quality JPG at the folder, but category images are different since they are always generated by the import.

TIA.

EDIT:
It would also be greatly appreciated, if someone could just tell me where is this resizing/resampling is taking place - I will try to take it from there on my own.
Specifically, I am talking about the resizing that is taking place when I import categories with URLs to images, and these images are manipulated then placed in their new place.

Link to comment
Share on other sites

Thanks, I think I looked in images.inc.php - will look again.
But, resize itself is a good thing that it does - if you want to change sizes there is a nice configuration tab (under preferences) for that.

I don't want to touch TOO MUCH in the code, cause then I will have to redo everything when a new release comes out.
But sure thing, if I find a way to change the way the resizer works or disable it, I will post here.
(I just want to tell the damn thing to use higher quality JPGs, or even better, see if I can make it render PNGs instead, which will probably be smaller than 100% JPGs and at source quality - just cant stand the JPG stains)

Link to comment
Share on other sites

Ok,

Interesting stuff.
A lot of things going on in images.inc.php.
I noticed that the JPG quality is set to 90 there (at least I think so) in the function returnDestImage()
So, I am chanhing to 100 to see how this will render.

I hope this is the place that controls all the image renders.

But what made me think, is that I see handling in the same function for PNG images - so I was wondering if anyone knows why is it converting images that I put as PNG, to JPGs?

Even though the code looks nicely organized, I never used the GD library, so I dont want to start messing with things here without knowing what I am doing.

EDIT:
Ok, much much better.
natngnear - heres the deal:
If you want to change image related stuff, this is definitely the place.
The function imageResize is probably where you want to start. If you need my help here, I can try and look at it with you, although I am by no mean an expert on image manipulation through PHP.

If you want to change the quality of the JPGs from the default 90% to 100% (which to me is a dramatic improvement) - you can do so in the function returnDestImage()

Now, one thing left, although it is a little less urgent now - if someone knows why PNGs are converted to JPGs, and if there is a way to avoid it, I would love to know.

Thanks
(P.S. Even though I find myself complaining a lot, I think Presta is just great!) :)

Link to comment
Share on other sites

Hi,

The IMAGE modification in prestashop is done by JAVASCRIPT named CROPPER (open source)


The JavaScript image cropper UI allows the user to crop an image using an interface with the same features and styling as found in commercial image editing software. and is is possible to modify it ........

I still load by hand my png's in this way I dont go by cropper and have 100% quality ........

Cropper also changes PNG's to JPG's ........
It's a complicated script that re-maps the image file .....

Bye

David

ps: LINK CROPPER == http://www.defusion.org.uk/code/javascript-image-cropper-ui-using-prototype-scriptaculous/

Link to comment
Share on other sites

Hey David, whats up.

I think the cropper.js is only used in interactive, client side, cropping and resizing.
It looks that all other (server side) image manipulations (for example, crop and resize images coming from the Import function) are done by the PHP GD library and all functions reside in that mystic-all-important images.inc.php file :)

I may be wrong, but this is how it seems to me.

Link to comment
Share on other sites

Hi,
It's 0h20 here in Dakar but this thing is getting interesting ...
So this is what Im going to try out :
My web site is on my localhost
I am going to replace the image files with the same size PNG's in the www\img\c folder where the images are stored
Then changing the .jpg in the pho file by .png an see what the rendering will be
This will take abot 30min
so see you later ...
David

Link to comment
Share on other sites

Hi again...
So instead of changing the php I just loaded the images in a PNG format to www\img\c folder then with a good old DOS instruction renamed them in .jpg's

It works just fine ... the high quality png's come to the screen ... (named as jpg's)

BUT I think that the main reason for using jpg instead of png's is the SIZE and therefore the TIME in loading !!!
My jpg large files are 28K and the same in png is 57k !!!!
I will be filling my website soon so if I put in 200 articles it's going to be 2k 3k 6k 14k and 28k Just for 1 single article =53K
If I do the same with png's that will give me 4k 6k 12k 28k 56k = 106K !!!
Now 200 X 53K = 106Meg and 200 X 116K = 230Meg plus the additional time in loading ...

In my sence for the BIG images 450 X 450px maybe it would be good to load the png's and rename but for the others !!! they are very small on a screen that in antcase will not render more than 96dpi .......
I did leave my background file in png on my site and it is 980 x 1447 .... a jpg would have been too ''nasty'' !!!



David

Link to comment
Share on other sites

DJ, agree.
I think that whenever possible, Presta should try and avoid changing the format, file type or size of the incoming images.

I understand that in some cases there may be no choice, but I also think there are places it can be done.

For example, in Homepage image and Category images, if I upload PNG at the exact required size (as defined in Preferences -> Images) then Presta should copy it as is, instead of putting it through the GD processors.

I am guessing that for someone who knows the internals of Presta a little better than me, this should not be a big deal to change.

I would attempt to do this change myself, only I noticed that calls for images are sometimes hardcoded in many places (modules / includes / tpls) so I am afraid of breaking it.

Link to comment
Share on other sites

Good morning,

Finally I should think that when its really necessary the best way is to download the PNG's and change the file extension...
On my site I did hard code the background image as I said earlier its 980 X by 1447 px ... no resizing possible...

And its rather simple to do ... Just load with the tools the images you need ... Look in the ''img\c'' directory and load into it with ftp a ''png'' file named ''jpg'' It works fine and you get the required quality ...

AS for the Animated or transparent gif 's ... I duplicated the ''blockadvertising'' module renaming ''blockpuba'' and ''blockpub'' hard coded the call to its image bloc into ''.gif'' instead of ''.jpg'' when presta finds the new module he installs it and you find the same tools as with the ''blockadvertising''.. (In my case i took out the '''' ... and again its works just fine .. animated or transparent .....


The same thing for my WESTERN UNION block it's just the ''bankwire'' modified with the western logo and some text change ...

For the moment I pass a few hours modifying the global.css and inserting my ''who does what comments'' just to see how everything works ... once completed I will try re-writing my own !!!

OK thats all for this morning

Good luck to all ;-)

David

Link to comment
Share on other sites

How about than to try to get GIF instead of PNG?
For those who want images with transparency?


Yes if you have seen my site you will notice the ''blockpuba'' and the ''blockpubb'' are animated GIF'S using the dowload by FTP and changing the file extension into ''.jpg'' the gif will always be a gif .. animated or transparent !!


;-P

David
Link to comment
Share on other sites

×
×
  • Create New...