Jump to content

How to make a Picture Resizer? Oo..


rootKID
 Share

Recommended Posts

Hello W3S people again. once again im in a little need of help. at least to get it started, im a little lost in this matter...im in the half-way exams at this week. and we got told to make a admin system that could upload images to products... that part i (CAN) do...but here comes my problem... i dont know the part of resizing the images...any ideas or suggestions would be pretty awsome! and thats not for kidding...i just need a little help for the beginning of it, so i can see the syntax... Hoping answers or suggestions soon!... thanks alot in advance! :).

  • Like 1
Link to comment
Share on other sites

I just preload a pic inside a div with a preset height and width and use a form to manipulate the properties I've built in the script. Image margin and width and height ( as % of the px) allow me to crop the pic in seconds.

Edited by niche
Link to comment
Share on other sites

thanks for the advice... but that part i allready know on how to do... that is actually pretty easy if you ask me :P... but the problem lies in that part that we (have) to do the resize if we can... i can't right now... but im at least trying... PS: is there not a way to do this in PHP coding?...

Link to comment
Share on other sites

thanks for the advice... but that part i allready know on how to do... that is actually pretty easy if you ask me :P... but the problem lies in that part that we (have) to do the resize if we can... i can't right now... but im at least trying... PS: is there not a way to do this in PHP coding?...
There is... go to: http://php.net/manual/en/book.image.php
  • Like 1
Link to comment
Share on other sites

As a practical matter how is imagecopyresampled() different from adjusting a pic's height% and width% with css? I understand the the processes are different, but what are the advantages, over css, demonstrated by #1 & #2 example at http://php.net/manual/en/function.imagecopyresampled.php ?

Link to comment
Share on other sites

Styling with CSS still causes the entire file to be transferred from the server, and the resizing performed by the browser does not include resampling so the picture looks less smooth. If you actually resize the file then you don't need 1MB to download a picture that you're going to show at only 300x200.

  • Like 1
Link to comment
Share on other sites

ok, thanks.. will try out the stuff... been helpfull so far... thanks! :)..

Link to comment
Share on other sites

hello again, just a fast question... i am trying to make a small if statement... like so:

($k_row['til_dag'] == 0) ? "": "$k_row[til_dag]";

but its not numbers im getting out, but words... so am i stupposed to use the (== 0)?... or what else should i use?... thanks in advance... :)...

Link to comment
Share on other sites

Did you really mean "$k_row[til_dag]" or do you want $k_row['til_dag']? If not, please provide more context.

Link to comment
Share on other sites

sorry for late reply all... and thanks birbal, i will read up upon it... and niche, i did mean ("$k_row[til_dag]")... what diffrence does it makes?...

Link to comment
Share on other sites

Well in the ternary, in post #10, if your first condition doesn't equal 0 text is returned. "$k_row[til_dag]" is text obviously.

Link to comment
Share on other sites

PHP does variable interpolation in between double quotes. What I don't see is the how the OP is getting a value from that line, since is he just checking the condition, not doing anything with it. Can the entire code be posted? What is text that you aren't expecting to be text? Have you debugged to check it's value before and after you do anything to it? You need to debug and show us all the relevant code and tell us what is/isn't working.

Link to comment
Share on other sites

lol... i have allready finded out, it was a freaking (echo) statement i forgot.. sorry guys, allready done the job... but to try finish what i was going to tell, then i was trying to output somfthing from db (the days names... Monday,Friday,ect...) and then some hours like (11.pm-10-am,ect...) to show people in a shop im making when the shop is open and go on... but that is fixed and done now...so no worries... so the if statement worked/works ;)...

Link to comment
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...