Jump to content

HOW DO I: image submit at fixed size(88x31)


eyeh8f8

Recommended Posts

First off i am new to php so this may be simple to some but not me.

 

What i want to do is have it so when an image is submitted to my site it is at a fixed 88 by 31. Is there something i do with the sql or php or both.

 

also I am trying to learn as much from this experience(making the script.) so could you give me just what i need to create that part of the script and no more. if i have anymore questions on this script, i will ask in this thread(of course there are other parts to the script)

 

also if that seems rude or anything, sorry, i just want to say that i did some of the work on my own, and without asking a hundred billion questions.

Link to comment
https://forums.phpfreaks.com/topic/70283-how-do-i-image-submit-at-fixed-size88x31/
Share on other sites

Take a look at the image functions in php, particullary:

 

http://www.php.net/manual/en/function.imagecopyresampled.php

 

and the related ones needed (imagejpg(), imagecreatetruecolor(), etc)

 

There's a couple of examples that can help you work your way up from them. Alternatively, you can just use CSS to force the submited images to 81x33, although they will look ugly sometimes and will not save you server space.

 

Hope that helps, Cheers.

Then you can use getimagesize(). It's right in the examples, something like:

<?php
list($width, $height) = getimagesize($uploaded_image);

if ( ($width > 81) || ($height > 33) ){
    echo 'upload invalid';
}else{
    do_upload_thingy();
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.