Jump to content

HungryMind

Members
  • Posts

    189
  • Joined

  • Last visited

HungryMind's Achievements

Member

Member (2/7)

0

Reputation

  1. I tried another method: resize.php header('Content-Type: image/png');$filename = $_GET['filename'];$w = $_GET['w'];$h = $_GET['h'];list($width, $height) = getimagesize($filename);$new_width = $w;$new_height = $h;$image = imagecreatefrompng($filename);$image_p = imagecreatetruecolor($w,$h);imagealphablending($image_p, false);imagesavealpha($image_p, true);imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);imagepng($image_p);imagedestroy($image);imagedestroy($image_p); but when i'm passing *.php through file_get_contents It's giving me warning: Warning: file_get_contents(resize.php?filename=1.png&w=50&h=50) [function.file-get-contents]: failed to open stream: No such file or directory in C:Program Fileswampwwwprojectajax.php on line 13 function resizeImage($filename){ $ret = base64_encode(file_get_contents($filename)); This is line no. 13 return $ret;}echo resizeImage('resize.php?filename=1.png&w=50&h=50');
  2. Hi Guys, I'm resizing an image with "imagecopyresampled". But i want base64_encode data in return without creating TEM file. function resizeImage($filename, $new_path, $w, $h){ list($width, $height) = getimagesize($filename); $new_width = $w; $new_height = $h; $image = imagecreatefrompng($filename); $image_p = imagecreatetruecolor($w,$h); imagealphablending($image_p, false); imagesavealpha($image_p, true); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); imagepng($image_p, $new_path); imagedestroy($image); imagedestroy($image_p); $ret = base64_encode(file_get_contents($new_path)); return $ret;} In this code, i'm creating a TEMP file. But this method is too heavy for me. imagepng($image_p, 'I DONT WANT to CREATE any TEMP FILE'); I tried ob_get_content examples, but i failed :/ Please guide. Specially waiting replies from my ever loving teachers: thescientist & justsomeguy
  3. OMG You are really awesome boss Yes! you are right. We need to rotate 90 degree when i get orientation case 8 Wow! i'm really happy I'll implement this tomorrow then i'll reply you back with sample Thank you sooo much sir
  4. hi sir, thanks for suggestion. i tried php_exif but still getting same issue please check attached image.
  5. But sir i want to do it with php. It's a part of my watermark script tool. Anyone can upload any dimensional image then my script will detect images by their dimention and it will apply landscape watermark image to landscape images and portrait watermark image to portrait images.
  6. Yes sir, if i'm creating a new file. It works perfect. But when i'm using my camera images! only portrait images have an issues. I've uploaded my files. It's too simple sample files. You can test by yourself. I hope you will enjoy this funny thing Please download my camera images: http://www.muhammadsameer.com/projects/php_getimagesize/watermarks.rar
  7. Thanks for reply sir Both images are displaying correctly. the landscape one is showing as landscape and portrait one is showing as portrait. Please Check This Attached Image:
  8. Try to remove ^ from start and $ from end and then test code again.
  9. Hi, I'm facing some php funny issues while im getting image sizes from php. Please check uploaded "IMAGE" file. I've described in detail everything there. These are my codes: Javascript getimagesize sample code: <html><body><script>// landscapevar l = new Image();l.onload = function(){ alert('landscape: width ( ' + this.width + 'px ), height ( ' + this.height + 'px )');}l.src = 'landscape.jpg';// portraitvar p = new Image();p.onload = function(){ alert('portrait: width ( ' + this.width + 'px ), height ( ' + this.height + 'px )');}p.src = 'portrait.jpg';</script></body></html> PHP getimagesize sample code: <?phplist($wl, $hl) = getimagesize('landscape.jpg');list($wp, $hp) = getimagesize('portrait.jpg');print "<p>landscape: width( " . $wl . "px ), ( " . $hl . "px )</p>";print "<p>portrait: width( " . $wp . "px ), ( " . $hp . "px )</p>";?> Please guide me. Mr. "JustSomeGuy", Mr. "Boen_Robot", Mr. "Scientist". You guys are my old teachers Please find attached.
  10. @Deirdre's Dad, @thescientistYou both are my old teachers. Please guide me to make simplest script for JQuery Sliders for new users.
  11. Hi Guys,This is the link of my code preview:http://www.muhammads.../simple-slider/Everything is working perfect. But when i'm using code for auto slide.On Click Left & Right Button, My slider slides lately.I don't recognize why.This is the simple code.Please guide me friends. <script>var cnt = 0;var track = 3;var setLeft = '';$(document).ready(function(){var canvas = $('div.canvas');var canvasWidth = canvas.width();var slides = canvas.find('ol.slides');var slidesWidth = slides.width();var single = slides.find('li');var singleWidth = single.width();var active = parseInt(canvasWidth/singleWidth);var slidesSize = single.size();var slidesCount = parseInt(slidesSize-active);var singleSlide = parseInt(single.width());var setDelay = 2000; // 1Second x 1000var reSlide = track; // 1Second x 1 $('a.left').click(function(){ track = 0; if(cnt != 0) { slides.animate({left: '+=' + singleSlide}); cnt--; }}); $('a.right').click(function(){ track = 0; if(cnt < slidesCount) { slides.animate({left: '-=' + singleSlide}); cnt++; }}); setInterval(function(){ if (track == reSlide) { if(cnt != slidesCount) { cnt++; setLeft = '-=' + singleSlide; } else { track = reSlide; cnt = 0; setLeft = '+=' + (slidesWidth-canvasWidth); } slides.delay(setDelay).animate({left: setLeft}); } else { track++; }}, setDelay);});</script>
×
×
  • Create New...