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. Hi I am new to php i want to develop a code where i can upload images from backend and also able to delete selected images please provide me help for it
  2. Hi, This is my first post and I would like to kick it off with a question I am trying to write a function that grabs the most relevant image from a website, however I encounter a few problems for which I need a bit of help for. To get into what I am trying to accomplish I suggest reading the article on : shareaholic This article describes quite in depth what you should do to grab the most relevant image from a website. Most functionality as described in that article are functional in my own program. just 32KB of images are fetched to get the headers so that i can calculate the width & height and aspect ratio. the array is sorted, big on top, small on bottom All OG Meta tags and Twitter Tags are found and stored in an array todo: compile a list of most used DIV ID for content, wordpress is using 'content' and other CMS's 'main' . etc etc With the information I should be able to grab the most relevant image from most websites, BUT... The thing that I encounter is that the biggest image is not always the most relevant image plus some ad images on certain websites have the perfect aspect ratio and are quite big, so I get wrong results. Did anyone here ever tried to do the same thing? and if so, how did you work around 'my' problem? Perhaps my approach is totally not correct. Thanks in advance, W//
  3. Hi. I have a problem where when i try to display the uploaded JPEG file, the browser would only dispay the placeholder for an image . I think the problem is within the 3rd IF statement. Please help me thanks. <?php if($_SERVER['REQUEST_METHOD'] == 'POST') { if(isset($_FILES['photo']) && is_uploaded_file($_FILES['photo']['tmp_name']) && $_FILES['photo']['error']==UPLOAD_ERR_OK) { if($_FILES['photo']['type']=='image/jpeg') { echo 'asdsad'; $tmp_img = $_FILES['photo']['tmp_name']; $image = imagecreatefromjpeg($tmp_img); header('Content-Type: image/jpeg'); imagejpeg($image, NULL, 90); imagedestroy($image); } else { echo "Uploaded file was not a JPG image."; } } else { echo "No photo uploaded!"; }} else { echo " <form action='test.php' method='post' enctype='multipart/form-data'> <label for='photo'>User Photo:</label> <input type='file' name='photo' /> <input type='submit' value='Upload a Photo' /> </form> ";} ?>
  4. Hello I have a script that puts text on a picture... i need help, i dont know to position these captions ? i need the topcaption to be center top and the bottom center bottom but i do not know how to achieve this. here is my code so far, any help is greatly appreciated. $picture = $_GET['image']; $topcaption = $_GET['topcaption']; $bottomcaption = $_GET['bottomcaption']; //Set the Content Type header('Content-type: image/jpeg'); if (isset($_GET['image'])){ // Create Image From Existing File $jpg_image = imagecreatefromjpeg("../useruploadedphotos/$picture"); // Allocate A Color For The Text $white = imagecolorallocate($jpg_image, 255, 255, 255); // Set Path to Font File $font_path = '../fonts/Timeless-Bold.ttf'; // Set Text to Be Printed On Image $text = $topcaption; // Print Text On Image imagettftext($jpg_image, 0, 0, 0, 0, $white, $font_path, $text); imagejpeg($jpg_image, "../photos/$picture"); imagejpeg($jpg_image, "../useruploadedphotos/$picture"); imagejpeg($jpg_image); // Clear Memory imagedestroy($jpg_image); // header("location: success.php"); }
  5. Hi everyone. I am new to PHP and i am trying to upload multiple images using a form. I need to send those images to the admin of the site via mail. Can anyone help me and show me a little demo? Here is the code of form for start <form enctype="multipart/form-data" id='cartform' name='cartform' method='POST' action='<?php echo home_url('/submit-order');?>'> <div> <input name="userimage[]" type="file" multiple accept="image/*"> <input type='submit' name='submit1' value='Proceed'> </div> </form> I need want to get the images on next page and use them as attachment with mail to admin. I am using Wordpress
  6. Hello. How can I integrate a "gallery maker" with TinyMCE editor, with images from external source (I don't want to upload images to my website server, because I have a limited storage space).
  7. Hello everyone, I am trying to start using plogger as a way of organising a number of photos. However there a number of photos or images even that have been created with Adobe and are either PSD or EPS format (correct if I'm wrong). I know how to make it so plogger recognises them and uploads them, but there are no thumbnails and there is no way to view the file whatsoever, Is there a way either to code Adobe compatibility so that images are displayed, or is it possible to code in something along the lines of me being able to add thumbnails myself so that at least people know what they are viewing? Another bit which is not as important is how would I go about adding a download button within the big thumbnail section when people look at the image right before opening the full file? Thanks in advance.
  8. I have two questions, what am I doing wrong? my script isnt working. It doesnt return errors nor a rezised pic. My second questions is just asking for ideas of how to improve this script in terms of security and quality. any help is appreciated. <?php #TODO: find ways to improve quality $quality = '100'; //in imagejpeg() type function default quality = 75, min = 0, max 100 $maxW = '180'; $maxH = '180'; $dirLoad = 'photos/load/'; //thumb size dir $dirOriginal = 'photos/'; //original size dir if(isset($_GET['a']) AND isset($_GET['y']) AND isset($_GET['i'])){ $falbum = stripslashes($_GET['a']); $fyear = stripslashes($_GET['y']); $img = stripslashes($_GET['i']); } else { echo 'lol'; exit; } $locOriginal = $dirOriginal.$fyear.'/'.$falbum.'/'.$img; //get normal location of img $locSave = $dirLoad.$fyear.'_'.$falbum.'_'.$img; // location and how img will be save #TODO: maybe redefine algorith to use crop to add more pic quality list($originalW, $originalH) = getimagesize($locOriginal); $ratio = $originalW / $originalH; if($ratio > 1){ // landscape shape original photo $tgtH = $maxW/$ratio; $tgtW = $maxW; } else { // portrait shape Original photo $tgtW = $maxH*$ratio; $tgtH = $maxH; } //echo $originalW.'x'.$originalH.'@'.$ratio; #checking code behavior //echo '<br>'.$tgtW.'x'.$tgtH; #checking code behavior //get file extension $ext = explode('.',$locOriginal); $ext = end($ext); //only variables should be passed by ref with end $ext = strtolower($ext); //turn it into lower case to match with switch below, just in case switch($ext){ //open the image according to file extension #note: must image we will work with are jpg/jpeg extension, added switch just in case #also bmt files are not supported by this script case 'jpg': //$imgOld = @imagecreatefromjpeg($locOriginal); break; no need but makes it look uniform case 'jpeg': $imgOld = @imagecreatefromjpeg($locOriginal); break; case 'gif': $imgOld = @imagecreatefromgif($locOriginal); break; case 'png': $imgOld = @imagecreatefrompng($locOriginal); break; default: $imgOld = false; break; } return $imgOld; //create a blank img with target dim. $imgNew = imagecreatetruecolor($tgtW, $tgtH); //resample old img with new imgNew size [0,0,0,0] crop options ImageCopyResampled($imgNew,$imgOld, 0, 0, 0, 0, $tgtW, $tgtH,$originalH, $originalH); switch($ext){ // #edit added header, forgot to #also bmt files are not supported by this script case 'jpg': case 'jpeg': Header("Content-type: image/jpeg"); Imagejpeg($imgNew,$locSave,$quality); break; case 'gif': Header("Content-type: image/gif"); Imagegif($imgNew,$locSave,$quality); break; case 'png': Header("Content-type: image/png"); Imagepng($imgNew,$locSave,$quality); break; default: false; break; } ImageDestroy($imgOld); ImageDestroy($imgNew); ?>
  9. I am working on a project, that lets users register, upload a photo and have that photo as a profile image which then other users can view. I am not sure how to structure this. Here is how I would imagine the process goes. 1-During user registration, user mkdir to create a a new directory that uses the users email address for the name of this new directory. 2-Take users to a upload image page, if users dont upload one, then use a default image. 3-User uploads image. 4-Image gets stored into the directory, and the image name is sent to mysql database. 5-Echo image in users profile by using a SELECT query. 6-using an image tag, select directory name by echoing out the users email from the db, and echo the image name from the db at appropriate areas. Step 6 would kinda look like this: //Grab user email from db and set it to a variable, do the same for image name $user_email = $email_from_db; $user_image = $image_from_db; <img src="image/<?php echo=$user_email; ?>/<?php $user_image; ?> /> Not sure if this is how its done, or if this is a secure way, also I have no idea how I would let users upload an image. Can anyone give me some advice?
  10. I have been developing some code that will allow my client to chose whether she wants to put an image left, right or centred on her news page. The code is working brilliantly and allows her to do so (thanks to this forum!) However - the news title is displaying twice on the page. Once as an image and once as text........ I removed 'newsimage' from the sql query however it is still displaying the title as an image even though it is no longer looking for the image? Completely confused as to why it has started doing this. Heres the code: // Show latest 10 news items function top10news($s, $t, $u, $w) { session_start(); $con = mysqli_connect("*****************", "*****************", "*****************", "*****************"); if (mysqli_connect_errno($con)) { echo "<p class='sect'>Could not connect to the database</p>"; } else { $q = "SELECT DISTINCT newsitem.niid,newstitle,newssnippet,sitename,newsimage FROM newsitem INNER JOIN newsbusiness ON newsitem.niid=newsbusiness.niid LEFT JOIN newsimage ON newsitem.niid=newsimage.niid WHERE newsitem.niid=newsbusiness.niid AND newsstatus='enabled' "; if ($u != "Any") { $q = $q . "AND sitename='$u' "; } if ($s != "Any") { $parts = explode('-', $s); $y = $parts[0]; $m = $parts[1]; $q = $q . "AND YEAR(newsdate) = $y AND MONTH(newsdate) = $m "; } $q = $q . "ORDER BY newsdate DESC LIMIT 0,10"; $result = mysqli_query($con, $q); while ($tnrow = mysqli_fetch_array($result)) { echo " <div class='newssummary'>"; if ("" . $tnrow ['imageposition'] . "" == "None") { echo "<p class = 'newsmore' > <a href = 'newsitem.php?i=" . $tnrow['niid'] . "' > Read More</a > </p>"; } else if ($tnrow ['imageposition'] == 'Centre') { echo "<p class='newsmore'> <a href='newsitem3.php?i=" . $tnrow['niid'] . "'>Read More</a></p>"; } else if ($tnrow ['imageposition'] == 'Right') { echo "<p class='newsmore'> <a href='newsitem2.php?i=" . $tnrow['niid'] . "'>Read More</a></p>"; } else if ($tnrow ['imageposition'] == 'Left') { echo "<p class='newsmore'> <a href='newsitem.php?i=" . $tnrow['niid'] . "'>Read More</a></p>"; } echo "<div class='newspic'><img src='http://www.nortech.org.uk/news/" . $tnrow['newsimage'] . "' alt='" . $tnrow['newstitle'] . "' /></div>"; echo " <p><strong>" . $tnrow['newstitle'] . "</strong></p> <p class='news'>" . $tnrow['newssnippet'] . "</p> </div> <div class='padder1'></div> <div class='rtgreengp'></div> "; } mysqli_close($con); } } It seems to display correctly if I upload an image along with an article..... so from what I can see if there is no image uploaded, it is just replacing it with the news title? if that makes any sense....... Any advice out there?
  11. Hi. I have a file upload script and I want to allow css files to be uploaded as well. Here is my code allowing the certain filetipes allowed to be uploaded. || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/jpg") || ($_FILES["file"]["type"] == "image/pjpeg") || ($_FILES["file"]["type"] == "image/x-png") || ($_FILES["file"]["type"] == "image/png")) When I tried doing this code to allow css files through || ($_FILES["file"]["type"] == "text/css")) it didn't work. Should it? If not, what did I do wrong?
  12. Hi! I have an application where I need to add a "watermark" to an image displayed on a website. Here are the parameters: The image comes in various sizes and shapes, from 3,000 pixels to 20,000 pixels (square, round, rectangular tall/wide). The finished image is output at a lower proportional size to easily fit a tablet/laptop/desktop screen and down to as small as thumbnail, and can be png, gif, or jpg. The watermark is a company name, iDesign Street, repeated as many times as needed, proportionately-sized for the image. (I don't want a GIANT watermark on a small image or a tiny watermark on big image) The watermark needs to run diagonally (45-degree), repeated at intervals (proportional to image size) for vertical/horizontal rectangles and large images. The watermark text should be partially transparent so the viewer can easily see through it, but visible enough to discourage screen-grabs, and easy correction if it is grabbed. Filenames will come from other programs or a web-browser. input parameters would be, at a minimum, filename and output file size (size of smallest side--tall/wide--of input file), with the other items set in the program (company name, proportional size of watermark, repeat frequency as percent of image size, transparency, text font used, and output filetype), although it would be nice to be able to have input over-rides for all of those. Inputs must be "sanitized" to protect server (they should only be numbers and letters, but you never know what someone might try to sneak in with a direct call attempt). The goal is to make it difficult enough to prevent people from stealing the images, or cropping out the watermark, while at the same time not blocking the image. Here's the fun part: I haven't a clue how hard this is to do, nor how long it would take to do it. I've done programming myself and could probably figure it out if I spent a couple of days doing it. Someone here who already understands Imagick or one of the other php graphic packages could do it much faster, and probably much more elegantly! So, I am open to bids on doing this job. Payment will be half up front, one-quarter on delivery of code, remainder on acceptance of code as finished. This is not a rush job. I can be reached via my email: tkepner-at-aol-dot-com
  13. i want to store youtube thumbnnail in my folder with resize option. http://img.youtube.com/vi/BoVBdxftEF8/0.jpg this is the image thumbnail file_put_contents ("video_thumbnails/thumb.jpg",file_get_contents("http://img.youtube.com/vi/BoVBdxftEF8/0.jpg")); but it shows errors!!!
  14. I was writing a code which check whether the file upload was successful or not or the file/image is of supported type or not. The script though always returns a error of 'invalid file type' even if i upload the correct file type. what could be the the plausible causes for it ?? do i have a error in my code or something else ?? here is the code. if ( isset( $_POST[ 'submit' ] ) ) { $dir_1 = './images/'; $thumb_1 = '.images/thumb'; //making sure the uploaded file transfer was successful if ( $_FILES[ 'pic1' ][ 'error' ] != UPLOAD_ERR_OK ) { switch ( $_FILES[ 'pic1' ][ 'error' ] ) { case UPLOAD_ERR_INI_SIZE: die( 'The uploaded 1st image exceeds the upload_max_filesize directive ' . 'in php.ini.' ); break; case UPLOAD_ERR_FORM_SIZE: die( 'The uploaded 1st exceeds the MAX_FILE_SIZE directive that ' . 'was specified in the HTML form.' ); break; case UPLOAD_ERR_PARTIAL: die( 'The uploaded 1st image was only partially uploaded.' ); break; case UPLOAD_ERR_NO_FILE: die( 'No 1st image was uploaded.' ); break; case UPLOAD_ERR_NO_TMP_DIR: die( 'The server is missing a temporary folder.' ); break; case UPLOAD_ERR_CANT_WRITE: die( 'The server failed to write the uploaded the uploaded 1st image to disk.' ); break; case UPLOAD_ERR_EXTENSION: die( '1st image upload stopped by extension.' ); break; } //$_FILES[ 'pic1' ][ 'error' ] } //$_FILES[ 'pic1' ][ 'error' ] != UPLOAD_ERR_OK // making sure the file is being uploaded $error = 'The 1st image you have uploaded either was not of supported filetype.'; switch ( $type ) { case IMAGETYPE_GIF: $image_1 = imagecreatefromgif( $_FILES[ 'pic1' ][ 'tmp_name' ] ) or die( $error ); break; case IMAGETYPE_JPEG: $image_1 = imagecreatefromjpeg( $_FILES[ 'pic1' ][ 'tmp_name' ] ) or die( $error ); break; case IMAGETYPE_PNG: $image_1 = imagecreatefrompng( $_FILES[ 'pic1' ][ 'tmp_name' ] ) or die( $error ); break; default: die( $error ); } //$type $image_date_1 = @date( 'Y-m-d' ); list( $width, $height, $type, $attr ) = getimagesize( $_FILES[ 'pic1' ][ 'tmp_name' ] ); }
  15. Hi all I've been having issues making this code, I'm a huge noob and have been watching youtube videos for the past couple of days and trying to create a website with a database of my movies.(I know there are programs for this but I would like to make my own) This site is only going to be running on localhost. I'm having issues uploading my info(mainly the image for Poster) and if anyone could look at my code/database setup and help me out that would be great First here is a screenshot of what my database looks like. http://i.imgur.com/14DQTCh.jpg Next here is my index.html file <html> <head><title>Add Movie or Tv show</title></head> <body> <form enctype="multipart/form-data" id="myForm" action="addedinfo.php" method="post"> <h1 align="center"><strong>Add Movie or TV Show to Database</strong></h1> <p> </p> <p>Movie Name: <input type="text" name="Movie_Name" /><br /> </p> <p><label> Poster</label> <input type="FILE" name="Poster"> ><br> </p> <p>Genre: <select multiple name="Genre" id="Genre"> <option value="All" style="text-indent: 0px;" selected="selected">All</option> <option value="Action" style="text-indent: 0px;">Action</option> <option value="Adventure" style="text-indent: 0px;">Adventure</option> <option value="Animation" style="text-indent: 0px;">Animation</option> <option value="Biography" style="text-indent: 0px;">Biography</option> <option value="Comedy" style="text-indent: 0px;">Comedy</option> <option value="Crime" style="text-indent: 0px;">Crime</option> <option value="Documentary" style="text-indent: 0px;">Documentary</option> <option value="Drama" style="text-indent: 0px;">Drama</option> <option value="Family" style="text-indent: 0px;">Family</option> <option value="Fantasy" style="text-indent: 0px;">Fantasy</option> <option value="Film-Noir" style="text-indent: 0px;">Film-Noir</option> <option value="History" style="text-indent: 0px;">History</option> <option value="Horror" style="text-indent: 0px;">Horror</option> <option value="Mystery" style="text-indent: 0px;">Mystery</option> <option value="Romance" style="text-indent: 0px;">Romance</option> <option value="Sci-Fi" style="text-indent: 0px;">Sci-Fi</option> <option value="Short" style="text-indent: 0px;">Short</option> <option value="Sport" style="text-indent: 0px;">Sport</option> <option value="Thriller" style="text-indent: 0px;">Thriller</option> <option value="War" style="text-indent: 0px;">War</option> <option value="Western" style="text-indent: 0px;">Western</option> </select> </p> <p> <label>IMDB Rating:</label> <select name="IMDB_Rating" id="IMDB_Rating"> <option value="0" style="text-indent: 0px;" selected="selected">All</option> <option value="9.9" style="text-indent: 0px;">10</option> <option value="9" style="text-indent: 0px;">9+</option> <option value="8" style="text-indent: 0px;">8+</option> <option value="7" style="text-indent: 0px;">7+</option> <option value="6" style="text-indent: 0px;">6+</option> <option value="5" style="text-indent: 0px;">5+</option> <option value="4" style="text-indent: 0px;">4+</option> <option value="3" style="text-indent: 0px;">3+</option> <option value="2" style="text-indent: 0px;">2+</option> <option value="1" style="text-indent: 0px;">1+</option> </select> </p> <p>Quality: <label class="label">Quality:</label> <select name="Quality" id="Quality"> <option value="All" style="text-indent: 0px;" selected="selected">All</option> <option value="1080p" style="text-indent: 0px;">1080p</option> <option value="3D" style="text-indent: 0px;">3D</option> <option value="480p" style="text-indent: 0px;">480p</option> <option value="720p" style="text-indent: 0px;">720p</option> <option value="DVD" style="text-indent: 0px;">DVD</option> <option value="HDRip" style="text-indent: 0px;">HDRip</option> </select> </p> <p> Year: <input type="text" name="Year" /><br /> </p> <p>Trailer: <input type="text" name="Trailer" /><br /> </p> <button id="sub">Submit</button> </form> <span id="result"></span/ </body> </html> As you can see I'm trying to post the following information Movie Name, Poster of the movie, Genre, Rating, Quality, Year, and the Trailer Next I have my connection script db.php <?php $conn = mysql_connect("localhost", "root", "spencer"); $db = mysql_select_db('movies'); ?> Next my addinfo.php <?php include_once('db.php'); $Movie_Name = $_POST['Movie_Name']; $Poster = $_POST['Poster']; $Genre = $_POST['Genre']; $IMDB_Rating = $_POST['IMDB_Rating']; $Quality = $_POST['Quality']; $Year = $_POST['Year']; $Trailer = $_POST['Trailer']; if (mysql_query ("INSERT INTO movieinfo VALUES ('','$Movie_Name','$Poster', '$Genre', '$IMDB_Rating', '$Quality', '$Year', '$Trailer')")) echo "Successfull"; else echo "Failed" ?> and lastly I have a little javascript my_script.js $("#sub").click( function() { $.post( $("#myForm").attr("action"), $("#myForm :input").serializeArray(), function(info){ $("#result").html(info); }); clearInput(); }); $("#myForm").submit( function() { return false; }); function clearInput() { $("#myForm :input").each( function() { $(this).val(''); }); } The error I get is: Notice: Array to string conversion in C:\xampp\htdocs\movies\addedinfo.php on line 12 Successfull When I look at the database I notice a couple of things: 1 the image is 5B so I don't think it uploads right, along with in the Genre only seems to pick up the last selection of the multiple selection My overall goal is to make a website that I can use to have a database of all my movies and tv shows on that I can add too and search through to find something to watch. So right now I'm making code to upload movies to the database, later I will make a site that will show all of the different movies I have and will be searchable through the movie name, genre, rating, quality and or year. I appreciate any help very much!
  16. Hi, First of all i want to apologize if i posted this in the wrong section. I am not really sure where it will go. So Mods, if u feel this thread belongs elsewhere, please shift it there. Now my problem: I am making this interface for shoppers where they can input their shopping list and the program will return a map with the shortest route to get the stuff they want. I dont know how to generate a map using PHP. I have a basic layout of the map, but how do i mark the locations on the map and then output it to the user as a single image? Regards, Makrand
  17. Hello i am just wondering about this code - its strange... when i just work with one section it works... but thing is i want to create two images from the one image in the /temp/ directory. This will then have two sent to /small/ and /large/ but it just comes up blank with no error... yet it only happens with larger image file sizes and .JPG extensions instead of .jpg.... The strange thing is... if i just work with one section of the code... it works! ...whatever the image. Hope you can help. Thanks Lewis $image_name = 'image'; $product_src1 = 'plus_cms/image_uploads/product_images/temp/'.$image_name.'.jpg'; $product_src2 = 'plus_cms/image_uploads/product_images/temp/'.$image_name.'.jpg'; $product_src3 = 'plus_cms/image_uploads/product_images/small/'.$image_name.'.jpg'; $product_src4 = 'plus_cms/image_uploads/product_images/large/'.$image_name.'.jpg'; $targ_w1 = $get_width; $targ_h1 = $get_height; $im1 = imagecreatetruecolor($targ_w1, $targ_h1) or die('Cannot Initialize new GD image stream'); // Background to Image $img_r1 = imagecreatefromjpeg($product_src1); //Creating Image $image1 = imagecopyresampled($im1,$img_r1,0,0,$_POST['x'],$_POST['y'],$targ_w1,$targ_h1,$_POST['w'],$_POST['h']); imagejpeg($im1, $product_src3); $targ_w2 = $get_width * 2; $targ_h2 = $get_height * 2; $im2 = imagecreatetruecolor($targ_w2, $targ_h2) or die('Cannot Initialize new GD image stream'); $img_r2 = imagecreatefromjpeg($product_src2); $image2 = imagecopyresampled($im2,$img_r2,0,0,$_POST['x'],$_POST['y'],$targ_w2,$targ_h2,$_POST['w'],$_POST['h']); imagejpeg($im2, $product_src4);
  18. when i click on image1 with id=1, it stores in session and when i click on image2 with id=2, it stores in session too next to the first one, and when i click on image3 with id=3, it stores in session next to id=2. and so on.... i hope you understand what i am asking .... need help. i know how to get value from array.... like <?php// begin the sessionsession_start(); // create an array$my_array=array('cat', 'dog', 'mouse', 'bird', 'crocodile', 'wombat', 'koala', 'kangaroo'); // put the array in a session variable$_SESSION['animals']=$my_array; // a little message to say we have done itecho 'Putting array into a session variable';// loop through the session array with foreachforeach($_SESSION['animals'] as $key=>$value) { // and print out the values echo 'The value of $_SESSION['."'".$key."'".'] is '."'".$value."'".' <br />'; }?> /*************************************************************************************************************************************/ but wat i want is, cat ,dog,mouse,bird,crocodile,wombat,koala,kangaroo ... stored in array when i click on them.... i hope you understand.. please help!!! thanks and regards, jazz..
  19. Im creating a CMS for my site and in my admin page I have an add page that adds new content to my site LOCATED HERE and have added a few form fields. 2 of these are: IMAGE URL (text box) & UPLOAD IMAGE (select file button) When I fill in all the fileds and select an image using IMAGE URL and hit add article, it works fine and my form is saved to my database and is then displayed on my site. When I fill in all the fileds and select an image using UPLOAD IMAGE and hit add article, it adds the image to my selected folder in my cpanel but DOES NOT ADD TO DATABASE. My question is: How can I get it to add to the database? and save the new images location to the image field on the database? I have followed this tutorial when adding the upload file button to my page. Please do not show me links on how to do this as I already have read through them but I stuggle when it comes to adding this to my code. my add.php code is this. <?php session_start(); include_once('../include/connection.php'); if (isset($_SESSION['logged_in'])){ if (isset($_POST['title'], $_POST['content'])) { $title = $_POST['title']; $content = nl2br($_POST['content']); if (!empty($_POST['image'])) { $image = $_POST['image']; } else { $image = $_POST['imageupload']; if (isset($_FILES['imageupload'])) { $errors = array(); $allowed_ext = array('jpg', 'jpeg', 'png', 'gif'); $file_name = $_FILES['imageupload'] ['name']; $file_ext = strtolower (end (explode ('.', $file_name))); $file_size = $_FILES['imageupload'] ['size']; $file_tmp = $_FILES['imageupload'] ['tmp_name']; if (in_array ($file_ext, $allowed_ext) === false) { $errors[] = 'File extension not allowed'; } if ($file_size > 2097152) { $errors[] = 'File size must be under 2mb'; } if (empty($errors)) { if (move_uploaded_file($file_tmp, 'images/'.$file_name)) { echo 'File uploaded'; } }else{ foreach ($errors as $error) echo $error, '<br />'; } } } $link = $_POST['link']; $category = $_POST['category']; $brand = $_POST['brand']; if (empty($title) or empty($content)) { $error = 'All Fields Are Required!'; }else{ $query = $pdo->prepare('INSERT INTO mobi (promo_title, promo_content, promo_image, promo_link, promo_cat, promo_name) VALUES(?, ?, ?, ?, ?, ?)'); $query->bindValue(1, $title); $query->bindValue(2, $content); $query->bindValue(3, $image); $query->bindValue(4, $link); $query->bindValue(5, $category); $query->bindValue(6, $brand); $query->execute(); header('location: index.php'); } } ?> <?php if (isset($_FILES['Filedata'])) { // And if it was ok if ($_FILES['Filedata']['error'] !== UPLOAD_ERR_OK) exit('Upload failed. Error code: ' . $_FILES['image']['error']); $filename = $_FILES['Filedata']['name']; $targetpath = "../img/news/" . $filename; //target directory relative to script location $copy = copy($_FILES['Filedata']['tmp_name'], $targetpath); } ?> <html> <head> <title>Add Article</title> <link rel="stylesheet" href="../other.css" /> </head> <body> <div class="container"> <a href="index.php" id="logo"><b>← Back</b></a> <br /> <div align="center"> <h4>Add Article</h4> <?php if (isset($error)) { ?> <small style="color:#aa0000;"><?php echo $error; ?></small><br /><br /> <?php } ?> <form action="add.php" method="post" autocomplete="off" enctype="multipart/form-data"> <input type="text" name="title" placeholder="Title" /><br /><br /> <textarea rows="15" cols="50" placeholder="Content" name="content"></textarea><br /><br /> <input name="imageupload" type="file" id="image" placeholder="Imageupload" /> <input type="text" name="image" placeholder="Image" /><br /><br /> <input type="link" name="link" placeholder="Link" /><br /><br /> <input type="category" name="category" placeholder="Category" /><br /><br /> <input type="category" name="brand" placeholder="Brand" /><br /><br /> <input type="submit" value="Add Article" /> </form> </div> </div> </body> </html> <?php }else{ header('location: index.php'); } ?> please help. thanks.
  20. hi to all. I've been beating my head against the wall for a couple of days now trying to save a image as a valid ICNS file ( ICNS is the icon format for Mac OS ). Let's say I have a image of 128 x 128. I've managed to get the color and opacity for each pixel but I'm not really sure how the ICNS file format wants this data compressed. I found some pseudo-code but i can't figure out from that what I have to do: http://www.macdisk.com/maciconen.php3#RLE More info about icns file can be found on wiki: http://en.wikipedia.org/wiki/Apple_Icon_Image Does anybody have any good ideeas about this ? As wiki says, ( for example ) the 128 x 128 icns file should have the header it32, the 48x48 ih32, the 32x32 - il32 and the 16x16 - is32 $im = imagecreatefrompng("128.png"); $width = imagesx( $im ); $height = imagesy( $im ); $pixel_data = array(); $opacity_data = array(); $current_opacity_val = 0; for ( $y = $height - 1; $y >= 0; $y-- ) { for ( $x = 0; $x < $width; $x++ ) { $color = imagecolorat( $im, $x, $y ); $alpha = ( $color & 0x7F000000 ) >> 24; $alpha = ( 1 - ( $alpha / 127 ) ) * 255; $color &= 0xFFFFFF; $color |= 0xFF000000 & ( $alpha << 24 ); $pixel_data[] = $color; $opacity = ( $alpha <= 127 ) ? 1 : 0; $current_opacity_val = ( $current_opacity_val << 1 ) | $opacity; if ( ( ( $x + 1 ) % 32 ) == 0 ) { $opacity_data[] = $current_opacity_val; $current_opacity_val = 0; } } if ( ( $x % 32 ) > 0 ) { while ( ( $x++ % 32 ) > 0 ) $current_opacity_val = $current_opacity_val << 1; $opacity_data[] = $current_opacity_val; $current_opacity_val = 0; } } Thanks in advance for any help you can offer.
  21. Hey, so to display an image from a database I was using $id = addslashes($_REQUEST['id']); $image = mysql_query("SELECT * FROM store_image WHERE id=$id"); $image = mysql_fetch_assoc($image); $image = $image['image']; header("Content-type: image/jpeg"); echo $image; That worked fine to return an image via matching the id. But I want to get ALL images from the table.. I tried this: $image = mysql_query("SELECT * FROM store_image"); while($image = mysql_fetch_array($image)){ $image = $image['image']; header("Content-type: image/jpeg"); echo $image; } But did not work.. what am I doing wrong?
  22. I'm working on a file uploading script. It checks the file size, and won't let an upload complete if over a size specified in config. This all works, but if a file is uploaded that goes over PHP's limit, then I get the familiar warning: Warning: POST Content-Length of 14622352 bytes exceeds the limit of 8388608 bytes in Unknown on line 0 I am not looking to allow this file to go through. I don't want to increase memory or the max post size. That's not the issue. The upload script already has a way for the user to see if their file had problems uploading (showing errors), but how can I catch the error shown above? I know the error won't display if the error reporting and display of errors is turned off, but I don't want to leave the user in the dark. They should get some feedback. What can I do here?
  23. $handle = fopen($fullPath, "rb"); $bin=NULL; while(!feof($handle)){ $bin = $bin.fread($handle,sizeof($fullPath));} fclose($handle); //var_dump($bin); $db_lite = initDbLite(); $stmt = mssql_init('dbo.InsertFlagDownloadImage', $handleMS); mssql_bind($stmt, '@PatientNum', $paramArray['PatientID'], SQLINT2, false, false); mssql_bind($stmt, '@DloadLogNum', $DloadLogNum, SQLINT2, false, false); mssql_bind($stmt, '@FileTypeNum', $filetype, SQLINT2, false, false); mssql_bind($stmt, '@FlagDloadBinaryImage', $bin, SQLVARCHAR, false, false); mssql_bind($stmt, '@PassFail', $MsCheckArr['PassFail'], SQLVARCHAR, true, false, 25); mssql_bind($stmt, '@ErrorMsg', $MsCheckArr['ErrorMsg'], SQLVARCHAR, true, false, 101); mssql_execute($stmt); echo mssql_get_last_message(); First time poster so excuse an nuances of the forum I do not know yet. I have been facing this problem at work for the last couple days and even with relentless forum searching I have been unable to answer it. At my company we have an old C/C++ program that processes downloads from a sqlite db to a MSSQL db. My job, as the intern this summer, is to take that outdated (15 y.o.) program and convert it to a php script that does EXACTLY what it does. I had limited knowledge of php or database work up until this point but I was eager to learn. My program executes a series of stored procedures within a MSSQL db to store data. I learned quickly how to make this work and that the best way to do this was using bind because it prevents from being easily hacked (intercepted, is the other term I read over on the web). . My problem : In three of the stored procedures I need to store a BLOB in a MSSQL db stored procedure that accepts an image type. When attempting to use mssql_bind I get an error when inserting my data, regardless of the mssql datatype I use. My attempts at solving this : 1. Re-write the way I acquire my BLOB in an attempt to rule that out as the issue. -- failed 2. Scour the web for a MSSQL datatype that is compatible with the stored procedures image field. -- failed, I was unable to find anything that was IMAGE specific. 3. Increase the data transfer size in the freetds.conf file -- failed 4. Found in a forum on the web instructions to try SQLVARCHAR and SQLTEXT as the MSSQL datatypes -- failed, using SQLVARCHAR results in an error on the bind call and SQLTEXT results in an error on the execute call. Currently, I am at a wall with this project and don't really know where to go from here. Are there other ways of executing stored procedures without the use of bind? How much of the security side of things will not using bind compromise? Also, for what it's worth I found a bug report on the php website from about 5 years ago that describes my problem. The link is : http://grokbase.com/t/php/php-bugs/0644ny6bxe/36961-new-mssql-bind-will-not-bind-an-image-field Thanks for any and all help you all can give, MF
  24. I am working on code that can run images from left to right when I click on hyperlink ?? The code is listed below, please help me out ... <script type="text/javascript"> var left3; function next1() { var str = document.getElementById('pic01'); var left2 = parseInt(str.offsetLeft); left3 = left2; } function next2() { left3 =left3 + 50; var st = left3+'px'; document.getElementById('pic01').offsetLeft=st; } </script> <body onLoad="next1()"> <img src="pic1.jpg" height="100px" width="120px" style="margin-left:125px;" id="pic01"/> <br><br> <a href="#" style="margin-left:100px" onClick="next2()">Next</a> <body>
  25. So i have a website, here i have a backoffice. In the backoffice i can add new "places" and when i add a new place i want to be able to upload 1 picture of it. All good till now. So i have a from, and i want the image i upload do be resized to 800x600, and to create a thumbnail of 200px x 200px. So can someone help me? What is the best way to do this? Just store the path of the 800x600 image on the db and save the thumbnail with the same name of the 800x600 image but with thum in the front? Or save both paths in the db? Because the main goal is to show the place in the frontpage, like this: The thumb with the name of the place, and when i click on the thumb, i will get the 800x600 image with a lightbox. Can someone help me please?
×
×
  • 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.