Jump to content

More complex color attribute system


Truemedia
 Share

Recommended Posts

Sorry for the many requests, but I am beginning to understand the architecture of prestashop now thanks to the help. I have wanted to integrate an avatar system where people can buy free avatars for my website, to encourage them to use the store, and customise there profiles how they like. The avatars were gunna have multiple color attributes for properties of the avatar such as the font, the background, ect.
I know how to dynamically draw images using php with imagemagik which makes the php file appear as an image and how to send data through the URL, but I have two problems with implementing this system.
Prestashop by default only allows jpeg gif and png file extensions for images, which I'm not sure how to modify to allow for php. I'm also unsure how to add multiple color selections as normally you have 1 selection by default, so can anyone point me to how I could achieve this, or any compromises that require a less complicated approach. Thanks

Share this post


Link to post
Share on other sites

Prestashop by default only allows jpeg gif and png file extensions for images, which I’m not sure how to modify to allow for php.

You shouldn' t have to change anything for it to accept the images drawn by a php script, you just have to make sure your header content-type is set correctly in your php file that draws the image.

Share this post


Link to post
Share on other sites

It is, it is set to have the header-content type correct to png, but I think it is rejecting the file extension of .php

this is the error I get when uploading the php file that outputs itself as an image:

image format not recognized, allowed formats are: .gif, .jpg, .png


Anywhere in the database I can change the extensions?

Share this post


Link to post
Share on other sites

Im not adding any custom code to make this work at the moment, just using the back office to assign an image as the product image by uploading in the upload box on the info page I think it is, and ticking the box that says "use as cover".

Share this post


Link to post
Share on other sites

That is not going to work. You will have to add custom code to do that, changing the file extensions for accepted images won't do it, I'm afraid.
I believe that piece of code that handles those images stores the image in one of the image directories and updates the ps_image table.

Share this post


Link to post
Share on other sites

I have had an idea which makes it so I can achieve the same result, and the benefits of not modifying code I am unfamiliar with. Instead of a single php file that acts as an image by displaying headers and information to say so, I'm just gunna modify my existing image generation software to save the dynamic images as static image files for each different color combination, and upload them separately.
Not only will this avoid a major hack I noticed possible (anyone working within a product creation role could upload custom hack script to my website lol), but will be more friendly to my overall architecture of my website. Thanks for leading me to this solution, as I realize that my original idea is not precise enough to be a safe plausible method of doing what I wanted to do.

Share this post


Link to post
Share on other sites

Now, if the parameters of how you generate the images could be entered and then stored, that would give your idea a jump using an img tag that called the generation script using the stored parameters.

I agree that if you changed the accepted extensions, that could lead to disaster. It's just that there was not enough information given to come to a conclusion on what needs to be done.

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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More