Jump to content

Search the Community

Showing results for tags 'image'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

  1. Hello, I am trying to save image in mysql table using blob. I am show you my code [form page and backend page for insertion], please let me know where i am wrong ? <!DOCTYPE html> <html> <head> <title>Forms</title> <link href="css/kendo.metro.min.css"rel="stylesheet"> <link href="css/kendo.common.min.css" rel="stylesheet"> <script src="js/jquery.min.js"></script> <script src="js/kendo.web.min.js"></script> <script src="js/kendo.upload.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $('#btnSubmit').click(function(){ $.ajax({ type: "POST", url: 'data/create_new_property.php', data: "buildername=" + $('#buildername').val() + "&projectname=" + $('#projectname').val() + "&files=" + $('#files').val(), success: function(data){ $('#status').html(data); $('#buildername').val(''); $('#projectname').val(''); $('#files').val(''); } }); }); }); </script> </head> <body> <div id="example" class="k-content"> <div> <ul class="forms"> <li> <input type="text" class="k-textbox" id="buildername" value="Builder Name" onblur="if (this.value == '') {this.value = 'Builder Name';}" onfocus="if (this.value == 'Builder Name') {this.value = '';}"/> </li> <li> <input type="text" class="k-textbox" id="projectname" value="Project Name" onblur="if (this.value == '') {this.value = 'Project Name';}" onfocus="if (this.value == 'Project Name') {this.value = '';}"/> </li> <li> <input type="text" class="k-textbox" id="location" value="Location" onblur="if (this.value == '') {this.value = 'Location';}" onfocus="if (this.value == 'Location') {this.value = '';}"/> </li> <li> <input type="text" class="k-textbox" id="budget" value="Budget" onblur="if (this.value == '') {this.value = 'Budget';}" onfocus="if (this.value == 'Budget') {this.value = '';}"/> </li> <li> <input type="text" class="k-textbox" id="propertytype" value="Property Type" onblur="if (this.value == '') {this.value = 'Property Type';}" onfocus="if (this.value == 'Property Type') {this.value = '';}"/> </li> <li> <input name="files" id="files" type="file" /> </li> <li> <input type="text" class="k-textbox" id="area" value="Area" onblur="if (this.value == '') {this.value = 'Area';}" onfocus="if (this.value == 'Area') {this.value = '';}"/> </li> <li> <button class="k-button" id="btnSubmit">Save Project</button> </li> </ul> <style scoped> .forms { float: left; } .forms li { margin-bottom: 5px; list-style: none; } .forms li > * { width: 400px; } </style> </div> </div> </body> </html> php code to Insert data in mysql <?php header('Content-Type: application/json'); header('Access-Control-Allow-Origin: *'); header("Access-Control-Allow-Methods: POST, GET"); header("Access-Control-Allow-Headers: x-requested-with"); mysql_connect("localhost", "root", "") or die("Connection Failed"); mysql_select_db("property")or die("Connection Failed"); $bname = $_POST['buildername']; $pname = $_POST['projectname']; $uploadfiles = addslashes (file_get_contents($_FILES['files']['tmp_name'])); $image = getimagesize($_FILES['files']['tmp_name']);//to know about image type etc $imgtype = $image['mime']; //$query = "UPDATE test SET password = '$password' WHERE name = '$user'"; $query = "INSERT INTO projects (buildername, projectname, img) VALUES('$bname','$pname','$uploadfiles')"; if(mysql_query($query)){ echo "updated";} else{ echo "fail";} ?> Please correct me where i am wrong. Thanks a lot for your time
  2. Hey guys, i've been searching the web trying to figure out the best method of storing images in a database table when it comes to user registration. Basically, users will register with only 3 elements: Upload Image( turned into Avatar/Thumbnail), E-mail, and Password. Now i've figured out the basics on how to store user information such as the e-mail and pass, but I still haven't found any direct answers on the topic of properly managing user avatars/thumbnails. Now these avatars will be displayed everytime the user posts, much like any forum or social network. So, do I store the image itself in the database? Do I store it in a user_avatar file/directory on the server and have a direct link in the table to fetch and display the image? What would be the best method to go about this? I thought about maybe having a table with user_ID, avatar_ID and avatar_link(direct link to image).
  3. I am trying to write a script on a hidden page to delete images in my gallery(I am not using databases). I tried writing this code(to delete both the icon and large version of the image) but it failed. What did I do wrong? <?php if (array_key_exists('delete_file', $_POST)) { $filename = $_POST['delete_file']; if (file_exists($filename)) { unlink($filename); echo 'File '.$filename.' has been deleted'; } else { echo 'Could not delete '.$filename.', file does not exist'; } } $large = glob("/images/main/large/*"); $icons = glob("/images/main/icons/*"); foreach($large as $lrg && $icons as $icon) { echo "<div class='divimages'>"; echo '<img src="'.$lrg.'"/><br>'; echo '<img src="'.$icon.'"/>'; echo '<form method="post">'; echo '<input type="hidden" value="'.$lrg.'" name="delete_file" />'; echo '<input type="hidden" value="'.$icon.'" name="delete_file" />'; echo '<input type="submit" value="Delete image" />'; echo '</form>'; echo "</div>"; } ?>
  4. Hello, I have a table as follows; echo " <form method='get'> <center><img border='0' src='contest_winner.jpg' alt='test' width='452' height='384' class='center'></center> <table class='imagetable center'> <tr> <th>5/36</th> <th>6/40</th> </tr> <tr> <td> <select name='game1'> <option value='1'>111111</option> <option value='2'>222222</option> </select> </td> <td> <select name='game2'> <option value='1'>111111</option> <option value='2'>222222</option> </select> </td> </tr> <tr> <td> <input name='send1' type='submit' value='Check'> </td> <td> <input name='send2' type='submit' value='Check'> </td> </tr> <tr> <td> <-------- image here -----------> </td> <td> <-------- image here -----------> </td> </tr> </table> </form>"; I would like to add an image between TD's at the last TR of the table. How can I do it dynamically? Best Regards.
  5. I am new to php and I've downloaded a free source code for image gallery. It has admin account and you can upload image on it. Now when I upload image it generates random image title like numbers '4849404'. I want it to assign a specific title per image or just simply fetch the file name of the uploaded image and assign it as the title. How can I do that? here is the code.... $RandomNumber = rand(0, 9999999999); // We need same random name for both files. // some information about image we need later. $ImageName = strtolower($_FILES['ImageFile']['name']); $ImageSize = $_FILES['ImageFile']['size']; $TempSrc = $_FILES['ImageFile']['tmp_name']; $ImageType = $_FILES['ImageFile']['type']; $process = true; //Validate file + create image from uploaded file. switch(strtolower($ImageType)) { case 'image/png': $CreatedImage = imagecreatefrompng($_FILES['ImageFile']['tmp_name']); break; case 'image/gif': $CreatedImage = imagecreatefromgif($_FILES['ImageFile']['tmp_name']); break; case 'image/jpeg': $CreatedImage = imagecreatefromjpeg($_FILES['ImageFile']['tmp_name']); break; default: die('Unsupported File!'); //output error } //get Image Size list($CurWidth,$CurHeight)=getimagesize($TempSrc); //get file extension, this will be added after random name $ImageExt = substr($ImageName, strrpos($ImageName, '.')); $ImageExt = str_replace('.','',$ImageExt); $BigImageMaxWidth = $CurWidth; $BigImageMaxHeight = $CurHeight; //Set the Destination Image path with Random Name $thumb_DestRandImageName = $Thumb.$RandomNumber.'.'.$ImageExt; //Thumb name $DestRandImageName = $DestinationDirectory.$RandomNumber.'.'.$ImageExt; //Name for Big Image //Resize image to our Specified Size by calling our resizeImage function. if(resizeImage($CurWidth,$CurHeight,$BigImageMaxWidth,$BigImageMaxHeight,$DestRandImageName,$CreatedImage)) { //Create Thumbnail for the Image resizeImage($CurWidth,$CurHeight,$ThumbMaxWidth,$ThumbMaxHeight,$thumb_DestRandImageName,$CreatedImage); //respond with our images echo '<table width="100%" border="0" cellpadding="4" cellspacing="0"> <tr><td align="center"><img src="gallery/'.$RandomNumber.'.'.$ImageExt.'" alt="Resized Image"></td></tr></table>'; }else{ die('Resize Error'); //output error }
  6. Hi, sorry if this has come up before. I had a quick look through the forum but could find anything. I've been having a problem with this code for the last while and I can't seem to figure it out. I'm not all that proficient in PHP. I've a gallery of images from a festival. When people looking through the photo's spot themselves they click a callout "I'm in this photo!' When they click the call out a window pops up with a form. I need the imageID to transfer to that form, and then after completion of that form gets saved to the data base. Page 1: The Gallery. <li> <a class="thumb" name="007" id="007" href="images/9133440_DSC_0087.jpg" title="Title #6"> <img src="images/9133440_DSC_0087_thumb.jpg" alt="Title #6" /> </a> <div class="caption"> <!-- <div class="image-desc">Description</div> --> </div> </li> </ul> </div> <div id="inphoto"> <a href="#" onclick="wopen('compentry.php?imageid=<?php echo $imageID; ?>', 'popup', 448, 590); return false;"><img src="assets/inphotobutton.jpg"></a> </div> Page 2: The Competition Form. <div id="form"> <form name="epcomp" id="epcomp" method="GET" action="form.php" > <p class="name"><label>Full Name:</label><br/> <input type="text" name="name" id="name" value="Your Name" onblur="if(this.value == '') { this.value='Your Name'}" onfocus="if (this.value == 'Your Name') {this.value=''}" maxlength="30" required/></p> <p class="email"><label>Your Email:</label><br/> <input type="email" name="email" id="email" value="Your email" onblur="if(this.value == '') { this.value='Your email'}" onfocus="if (this.value == 'Your email') {this.value=''}" maxlength="60" required /> </p> <p class="entry"><label>Your favourite festival moment: <span style="font-size:10px;">(Max 50 words)</label> <br/> <p><textarea cols="40" rows="5" name="entry" id="entry" onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;" maxlength="50" required>Enter you answer here...</textarea></p> <p class="button"><input class="button" type="submit" value="Enter Competition" name="formSubmit"/></p> <?php echo '<input type="hidden" name="photoId" value="' . $_GET['imageID'] . '">' ?> </form> And Page 3: The Form.php page. $imageID = $_GET['imageID']; $varName = $_GET['name']; $varEmail = $_GET['email']; $varEntry = $_GET['entry']; $query = "insert into comp_entry (imageID, name, email, entry) values ('$imageID' , '$varName' , '$varEmail' , ' $varEntry')"; $qresult = mysql_query($query); ?> <input class="button" type="button" value="Close" onclick="closeWin()"> </div> Can anyone point me on the right path, any help would be greatly appreciated.
  7. Hi, New coder here! I'm making a php If loop that will post my image a set number of times (depending on user input in a text box), and I have that all figured out. However, I can't figure out how to rotate the image a random amount of degrees and have a random width/height for each image. Will rand generate new numbers for each time the image is echo-ed, or will it give the same number for all images? This is what I have: <?php function pic($picture) { $degree = rand(0,360) $num = rand(50,250) $total = 0; while ($total < $picture){ echo '<img src=blabla.gif width="$num" height="$num">'; $total = $total + 1; } } $picture = $_GET['input']; $a = pic($picture); } ?> Thanks in advance!
  8. Hi there, i'm busy with a project but know im stuck at some point. What i want to do is, when someone presses the home button it changes his color. How I wanted to do is swap from image 1 (white) to image 2 (blue). So the person can see on which page he/she is. But when i put this code into the website, it wont show nothing. When i press 2 times it will show the blue image. And when i press many times you see the white and blue image swapping. But it won't stand on the white image, only on the blue image Here is the code i use. --> <a href='' "<?php echo $this->createUrl("/admin/survey/sa/index"); ?>" onclick="edit()"><img id="img1" onclick="imageChange(this)"'<?php echo $sImageURL;?>home.png' alt='<?php $clang->eT("Default administration page");?>' /> <script type="text/javascript"> { var img1 = "/LimeSurvey/styles/scanyours/images/home.png"; var img2 = "/LimeSurvey/styles/scanyours/images/home1.png"; } { var imageChoice = 1; } function imageChange(element) { if (imageChoice == 1) { element.src = img2; imageChoice = 2; } else if (imageChoice == 2) { element.src = img1; imageChoice = 1; } } </script></a>
  9. Hello everyone i'm using this code and its not mine on greasemonkey to replace an image with another my problem is that the website i'm visting have dynamic content and the whole images keep reloading without i do refresh /f5 for page now how i can make the script call the the image "i want to see" every minute var images = document.getElementsByTagName ("img"); var x=0; while(x<images.length) { if(images[x].alt == "image i dont want to see") { images[x].src = "image i want to see"; } x=x+1; } thanksss
  10. Hello, Let me explain with an example. Lets say I have an Image of size 960px X 668px I have a div which holds this image. The div size is 154px X 75px This div can have any variable size. If we see that the aspect ratio of image and the aspect ratio of the div that holds image are different. All i need to do is Resize and Crop the Image in such a way that it takes maximum possible height and width of the original size and also maintain the aspect ratio of the div that holds this image. I just need a logic to calculate a percentage that by how much DIV width and height should be multiplied so that the resulting size is closer to the image size but doesnot exceed the image size and also the aspect Ratio will be same as that of DIV but not of image.. The motive to do this is that image exactly fits the div when scaled to div's size without stretching or disorting the image. Thanks watsmyname
  11. Fila54

    Justify images

    Hi ! I've got a little problem with creating my gallery. What I want is simply gallery which perfectly fits to my website. So I decided to make a lightbox gallery where thumbnails are justify. And there is my question how can I justify images in my div? I don't want to center them.
  12. I'm building a basic photo gallery, and I'm having difficulties with the 'Categories' section. The plan is to display all the picture categories inside divs, and have them 'rotate' their background images through the pictures in the given category. For instance, the 'Nature' category div would change its background every few seconds to a random image in the Nature category. I've succeeded doing this, but the code wasn't very efficient. Basically, I've had a JavaScript file gather all the categories (through uniquely assigned IDs) and "$.post" them to a PHP file which polled images with the given category from a database, loaded them into an array and returned a random key. Then, using intervals it updated the background every couple of seconds. But I'm looking for a better way to do it. I'd prefer to poll the database only once, at the start of the page, and then just let the JS file reload the rand() function each time the interval is called; but I'm not sure how to pass the polled data to the file that call the random function. Any ideas how to do this? Obviously, I'm not expecting anybody to write the code for me, I just need some assistance. Also, sorry if all this is a little unclear, it's 4am here, and I'm falling asleep; if you need me to explain just let me know. Thanks.
  13. I'm building a basic photo gallery, and I'm having difficulties with the 'Categories' section. The plan is to display all the picture categories inside divs, and have them 'rotate' their background images through the pictures in the given category. For instance, the 'Nature' category div would change its background every few seconds to a random image in the Nature category. I've succeeded doing this, but the code wasn't very efficient. Basically, I've had a JavaScript file gather all the categories (through uniquely assigned IDs) and "$.post" them to a PHP file which polled images with the given category from a database, loaded them into an array and returned a random key. Then, using intervals it updated the background every couple of seconds. But I'm looking for a better way to do it. I'd prefer to poll the database only once, at the start of the page, and then just let the JS file reload the rand() function each time the interval is called; but I'm not sure how to pass the polled data to the file that call the random function. Any ideas how to do this? Obviously, I'm not expecting anybody to write the code for me, I just need some assistance. Also, sorry if all this is a little unclear, it's 4am here, and I'm falling asleep; if you need me to explain just let me know. Thanks.
  14. Hey all, hoping to get this code solved. I am building an image gallery for a client's website and wanted a way for the client to upload their own images from the back end and shows up on the website page for the pictures. I am using color box as the lightbox feature for the photos and on the webpage thumbnails are displayed in rows. In the backend, I have the upload page and here is my form: <form name="form" action="../uploader.php" method="POST" enctype="multipart/form-data"> <label for="file">Filename:</label> <input type="file" name="uploaded_file" id="uploaded_file"> <input type="hidden" name="MAX_FILE_SIZE" value="10485760" /><br /> <input type="hidden" name="image_type" value="" /><br /> <input type="submit" name="submit" value="Submit"> <input type="hidden" name="MM_insert" value="form" /> </form> From the admin upload page, the client can upload their image and it will save it into the "image/uploads/" folder. Here is the uploader.php script: <?php //Сheck that we have a file if((!empty($_FILES["uploaded_file"])) && ($_FILES['uploaded_file']['error'] == 0)) { //Check if the file is JPEG image and it's size is less than 1.4MB $filename = basename($_FILES['uploaded_file']['name']); $ext = substr($filename, strrpos($filename, '.') + 1); if (($ext == "jpg") && ($_FILES["uploaded_file"]["type"] == "image/jpeg") && ($_FILES["uploaded_file"]["size"] < 10485760)) { //Determine the path to which we want to save this file $newname = dirname(__FILE__).'/images/uploads/'.$filename; //Check if the file with the same name is already exists on the server if (!file_exists($newname)) { //Attempt to move the uploaded file to it's new place if ((move_uploaded_file($_FILES['uploaded_file']['tmp_name'],$newname))) { echo "Upload Complete! "; } else { echo "Error: A problem occurred during file upload!"; } } else { echo "Error: File ".$_FILES["uploaded_file"]["name"]." already exists"; } } else { echo "Error: File too big to upload"; } } else { echo "Error: No file uploaded"; } ?> Now the website page will display all the images in the "images/uploads" folder and will update itself when new photos are uploaded. Here is the gallery code from the website: <div class="gallery"> <?php /* function: returns files from dir */ function get_files($images_dir,$exts = array('jpg')) { $files = array(); if($handle = opendir($images_dir)) { while(false !== ($file = readdir($handle))) { $extension = strtolower(get_file_extension($file)); if($extension && in_array($extension,$exts)) { $files[] = $file; } } closedir($handle); } return $files; } /* function: returns a file's extension */ function get_file_extension($file_name) { return substr(strrchr($file_name,'.'),1); } /** settings **/ $images_dir = 'images/uploads/'; $images_per_row = 5; /** generate photo gallery **/ $image_files = get_files($images_dir); if(count($image_files)) { $index = 0; foreach($image_files as $index=>$file) { $index++; echo '<a href="',$images_dir.$file,'" class="photo-link group1" rel="uploads"><img src="timthumb.php?src=',$images_dir.$file,'&h=150&w=150" /></a>'; if($index % $images_per_row == 0) { echo '<div class="clear"></div>'; } } echo '<div class="clear"></div>'; } else { echo '<p>There are no images in this gallery.</p>'; } ?> </div> With the help from timthumb.php and timthumb-config.php I am able to produce the thumbnails for the website. Once clicked, brings up the colorbox feature for the image slideshow. For some reason, this code only can use image sizes under 1500px. How can I upload a bigger image and resize it to save itself into the "images/uploads/" folder to be under 1500px? Please look at my codes and let me know where and what code I need to produce the resized image. Thanks!
  15. Hello all! Does anyone know how to insert directly into an image field of a SQL Server table, the image that the user selects from the input file of the form? thanks in advance!
  16. I am not sure if this is possible with my current setup but I figure I would give it a shot. I am not familiar at all with the Facebook API but I understand it might be needed for this. Also, my question might pertain to Javascript or HTML more than PHP, but I thought I'd throw it our here in case it does need PHP. I have a PHP script that takes an already existing image, throws text and borders on it from a user input form, and then creates a .png file. The .png file is only stored for a day before being removed, as the images are being attached to emails and sent immediately. The script itself works great! However, there's been a request to allow users to post the image to their Facebook page/wall in addition to attaching the image to an email. I myself have found no easy way to do this, as the image files are not permanently stored on the server. All the research I've done has turned up discussions that end with "this isn't possible" or no solutions. So obviously my question will be "is this possible?" And if it is, how would I achieve it? Thanks! EDIT: I feel it's important to add that I don't want to start storing the images on the server permanently.
  17. I have stored a image in database as it is small dd not upload in folder it got uploade and is shown in database i stored it with using $imgData =addslashes (file_get_contents($_FILES['image']['tmp_name'])); then a insert query with $imgData Now when i retrive it with select query from database and display <td rowspan="12"><?php header('Content-type:image/jpg'); $img=stripslashes($info['image']); echo $img; ?></td> it shows The image "localhost/final/../f.php?action="view&id=53" cannot be displayed because it contains errors
  18. I have a data base that updates the photo 1) A error occurs everytime i update the database error:- Error in Query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\0JFIF\0\0`\0`\0\0ÿÛ\0C\0 ' at line 3 code:- $sql = "UPDATE freelancer SET image=$imgData, name='{$_FILES['image']['name']} WHERE id=$in"; here $imgData is image with slashes 2) this is the error for Error in Query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''image-04.jpg WHERE id=29' at line 3 code:- $sql = "UPDATE freelancer SET image='$imgData', name='{$_FILES['image']['name']} WHERE id=$in"; please help for the error
  19. Hi, I've been searching on this scripts or plugin for website. I have no idea what you call it. I can only explain how it's look like. Here we go: Just like <map> in HTML, user can click or react with an image on certain position or shape. When a user mouse over a certain part of the image, I want another picture with few wording popsup. Eg: A world map picture is displayed on a web page, when a user mouse over a country, the entire land will be highlighted, and a small image box will come out and show the country's flag with the name of the country. This is just a simple scenario, i am looking a framework that can actually implement on many purpose. Wonder if there is anyone know about this kind of framework? Thank you!
  20. Dear fellow php programmers. Ik have 4 frames in an page and one contains pictures. I managed to get the pictures fullscreen, yet it does not resize when the index page is shown. It looks like this: And the goal is to make the picture fit perfect, so not half the picture, and adjust to its resolution. How can i fix this? Thanks in advance Dave
  21. hi i am creating a website where a user can post a title,upload an image, description of image and description of ad and with this i keep getting error writing to database could somebody help me with this code thanks. also i need to insert current date into the database thanks. <?php if ( !isset($_FILES['userFile']['type']) ) { die('<p>No image submitted</p></body></html>'); } ?> You submitted this file:<br /><br /> Temporary name: <?php echo $_FILES['userFile']['tmp_name'] ?><br /> Original name: <?php echo $_FILES['userFile']['name'] ?><br /> Size: <?php echo $_FILES['userFile']['size'] ?> bytes<br /> Type: <?php echo $_FILES['userFile']['type'] ?></p> <?php require 'mysql.php'; $title=$_POST['title']; $description=$_POST['description']; // Validate uploaded image file if ( !preg_match( '/gif|png|x-png|jpeg/', $_FILES['userFile']['type']) ) { die('<p>Only browser compatible images allowed</p></body></html>'); } else if ( strlen($_POST['altText']) < 9 ) { die('<p>Please provide meaningful alternate text</p></body></html>'); } else if ( $_FILES['userFile']['size'] > 16384 ) { die('<p>Sorry file too large</p></body></html>'); // Connect to database } else if ( !($link=mysql_connect($host, $user, $passwd)) ) { die('<p>Error connecting to database</p></body></html>'); } else if ( !(mysql_select_db($dbName)) ) { die('<p>Error selecting database</p></body></html>'); // Copy image file into a variable } else if ( !($handle = fopen ($_FILES['userFile']['tmp_name'], "r")) ) { die('<p>Error opening temp file</p></body></html>'); } else if ( !($image = fread ($handle, filesize($_FILES['userFile']['tmp_name']))) ) { die('<p>Error reading temp file</p></body></html>'); } else { fclose ($handle); // Commit image to the database $image = mysql_real_escape_string($image); $alt = htmlentities($_POST['altText']); $query = 'INSERT INTO image (title,type,name,alt,img,description,date) VALUES ("' . $title . '","' . $_FILES['userFile']['type'] . '","' . $_FILES['userFile']['name'] . '","' . $alt . '","' . $image . '","' . $description . '","' . $NOW() . '")'; if ( !(mysql_query($query,$link)) ) { die('<p>Error writing image to database</p></body></html>'); } else { die('<p>Image successfully copied to database</p></body></html>'); } } ?>
  22. Well, I have an image ans I want to write a text on it. The issue is, it is saying, image cannot be displayed because it contains errors. Refer to the screenshot below as attachment. Here the codes: <img src="images/img.jpg" width="500" height="300"> <?php header ("Content-type: image/jpeg"); $string = "This is my text"; $font = 4; $width = imagefontwidth($font) * strlen($string) ; $height = imagefontheight($font) ; $im = imagecreatefromjpeg("images/img.jpg"); $x = imagesx($im) - $width ; $y = imagesy($im) - $height; $backgroundColor = imagecolorallocate ($im, 255, 255, 255); $textColor = imagecolorallocate ($im, 0, 0,0); imagestring ($im, $font, $x, $y, $string, $textColor); imagejpeg($im); ?>
  23. I want to know the following aspects about GD library in PHP, so here my questions: 1/ I know we can write text in PHP on image using GD library. Can we rotate the text? 2/ Can we rotate an image or a text? 3/ Can we add shadow on the text? 4/ Can we move the text on any place on the image? I mean write the text anywhere on the image? 5/ On HTML5 Canvas, when you write a text,you cannot erase it as it is based on pixel. You have to clear the whole canvas and start again. I want to know if with GD library, can you clear a text if you have made a mistake and write another? Thank!
  24. Heya guys, I have this dynamic image slider thingy where users upload photos of their products, which means that the photos' sizes vary from very little to very large ones and I've tried a handful of solutions but none of them worked as I demand. All I need is to resize the image to match the user's screen ( or window size ) but not stretch in either width or height, can you please help me?
  25. Hello I have multiple images from a mysql database, I want to swap all these images onmouseover, IE, onmouseover, swap allthe images, each after some 3 4 seconds I amsure this will be done with javascript and probably jquery, So I need the Javascript (Or Jquery) function, and how to pass php parameters Naturally , there is a group of images, each will have more than one image to be swapped Many Thanks
×
×
  • 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.