Craig Hopson
-
Posts
212 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by Craig Hopson
-
-
YES thanksI wouldn't have PHP instantly generate a thumbnail, but rather generate the thumbnail and saving it upon uploading the picture. You could do that with this function: http://es2.php.net/manual/en/function.imagecopyresampled.php -
Scrap this anyone got a function that takes the ordinal image changes it to thumbnail and saves the output to thumbnail directory<IMG SRC="thumbnail.php?img=full_image.jpg"> do you have an example of this?The thumbnail.php script I did try but it seem to take long time to load -
<IMG SRC="thumbnail.php?img=full_image.jpg"> do you have an example of this?The thumbnail.php script I did try but it seem to take long time to load
-
Thanks guys you've done it again and answered my questions Thank you :Happy:
-
i found this
function ReduceImage($img){$img = file_get_contents ("$img");$im = imagecreatefromstring ($img);header ("Content-Type: image/jpeg"); imageJPEG ($im,NULL,10);imageDestroy ($im);}
but when i use it on my site i get cant modify headers and if i remove the "header ("Content-Type: image/jpeg");" line i get the binary data back
-
if i had 100 photos on my site all 1Mb in size and displayed them as thumbnails by this method
echo '<img src="'.$row['img'].'" height="100px" width="100px">';
it would be a 100Mb web page????is there a way to reduce quality on the fly i tried
$im = imagecreatefromjpeg($row['img']);imagejpeg($im, NULL, 60);
but this just outputs the LOADS of random code....
-
-
hi guys i have a image 100x100 in the top corners i want rotate icons i cant get the inline styles right please help this is the code (sorry its a mess)
echo '<li><div><div style="padding-top:10px;"><a href="index.php?x=rotate&img=uploads/'.$id.'/'.$file.'&rot=90&place='.$file.'" style="position: relative; left: 5px; top: 5px;"><img src="images/rotatec.png" style="border:0px;"></a> <a href="index.php?x=photoview&img='.$path.'"><img src="uploads/'.$id.'/'.$file.'" style="border:5px groove lightblue;" height="100px" width="100px"/></a> <a href="index.php?x=rotate&img=uploads/'.$id.'/'.$file.'&rot=-90&place='.$file.'" style="position: relative; right: 5px; top: 5px;"><img src="images/rotate.png" style="border:0px;"></a> </div></div><div><a href="delete.php?type=img&id='.$id.'&file='.$file.'"><img src="images/delete.png" style="border:0px"></a><a href="index.php?x=share&img=uploads/'.$id.'/'.$file.'&from='.$email.'"><img src="images/share.png" style="border:0px"></a></div></li>';
-
cos that was the only way i could get it to do what i wanted
-
yes there is another variable $ext holding the extension thanks i have sorted it like this
$filenameA = time() . '_'.$filename;$filename = $filenameA;
-
hi bit different problem but same topic so here goes, this code will change Avatar.png to Avatar1339516953.png
$filename .= time();
how would i get 1339516953_Avatar.png
-
Thanks
-
Thanks do you have example
-
ok i done this is it correct or is there a better way??
$srcImg = imagecreatefrompng($originalimg); imagejpeg($srcImg,$originalimg,100); imagedestroy($srcImg); $NewName = str_replace(".png",".jpg",$originalimg); rename($originalimg,$NewName);
-
yes i looked at that but if the file name changes like
$originalimg = $_GET['img']; $srcImg = imagecreatefrompng($originalimg); imagejpeg($srcImg,$originalimg,100); imagedestroy($srcImg);
how would i just change the extension from .png to .jpg but keep the file name the same
-
hi guys have this code which works file but i need to rename the file after its converted (xxxx.png to xxxx.jpg)
$originalimg = test.png$srcImg = imagecreatefrompng($originalimg); imagejpeg($srcImg,$originalimg,100); imagedestroy($srcImg);
-
Basically if the image being shown is upside down I have a rotate function in PHP but I need to know what photo is on the screen before I can call the rotate function
-
hi guys i have this line off code witch slideshows photos i want to set the current photo file name to be set as a PHP variable
bglayer.stop(true,true).css({opacity:1, zIndex:999}).empty().append($('<img src="'+imagesarr[i].src+'" />').css(this.scaleimage(imagesarr[i])))
Like this maybe
bglayer.stop(true,true).css({opacity:1, zIndex:999}).empty().append($('<img src="'+imagesarr[i].src+'" /><? $FileName ='+imagesarr[i].src+';?>').css(this.scaleimage(imagesarr[i])))
I REALLY DONT UNDERSTAND JAVASCRIPT AT ALL please help
-
Thanks this may just do it!!or you can lower the quality of the image using third parameter of imagejpeg() and imagepng() gif has not that option and bmp format cant be compressed. though you can convert those to jpeg and png and lower the quality. wahtever suits your situation -
How can i reduce image file size using PHP
-
ok so users can upload photos to my site the problem i have is space i'm cool with photo's upto 1 Mb but not any bigger how can i reduce the file size,the other problem i have is file type it could be any of the following jpeg, bmp, png or gif, I have searched Google for about an hour with no luck... Thanks
- 1
-
hi guys i have this function to rotate images
function rotate($img,$rot){//get the detail of the image $imageinfo=getimagesize($img); switch($imageinfo['mime']) { //create the image according to the content type case "image/jpg": case "image/jpeg": case "image/pjpeg": //for IE $src_img=imagecreatefromjpeg("$img"); break; case "image/gif": $src_img = imagecreatefromgif("$img"); break; case "image/png": case "image/x-png": //for IE $src_img = imagecreatefrompng("$img"); break; } //rotate the image according to the spcified degree $src_img = imagerotate($src_img, $rotation, 0); //output the image to a file imagejpeg ($src_img,$img);}
i know how to call it "rotate($img,$rotation)" but how do i USE it
<img src="uploads/'.$id.'/'.$file.'" style="border:5px groove lightblue;" height="100px" width="100px"/><a href="rotate(uploads/'.$id.'/'.$file.',90)" >Rotate 90</a>
I KNOW THE LAST CODE IS WRONG BECAUSE WE CANT USE SERVERSIDE FUNCTIONS BROWSER SIDEbut how is it done correctly Thanks
-
hi i have 2 errors on my site and i cant find them 72 attempt to find a semi-colon before the property name. add it 72 Property progid doesn't exist : DXImageTransform Line 72 is this
<div id="nav"> <ul> <li <? if($_SERVER['QUERY_STRING'] == ''){echo 'id="current"';}?>><a href="index.php">Home</a></li> <li <? if($_SERVER['QUERY_STRING'] == 'x=login'){echo 'id="current"';}?>><a href="index.php?x=login">Login</a></li> <li <? if($_SERVER['QUERY_STRING'] == 'x=register'){echo 'id="current"';}?>><a href="index.php?x=register">Register</a></li> <li <? if($_SERVER['SCRIPT_NAME'] == 'x=contact'){echo 'id="current"';}?>><a href="contact.php">Contact</a></li> <li <? if($_SERVER['QUERY_STRING'] == 'x=about'){echo 'id="current"';}?>><a href="index.php?x=about">About</a></li> <?php////////////////////////////////////////////////////////////////////////////LINE 72///////////////////////////////////////////////////////////// if (isset($id)){ ?> <li <? if($_SERVER['QUERY_STRING'] == 'x=menu'){echo 'id="current"';}?>><a href="index.php?x=menu">Menu</a></li> <li style="float:right"><a href="logout.php">Logout</a></li> <? } ?> </ul>
below is the error http://jigsaw.w3.org/css-validator/validator?uri=http%3A%2F%2Fchsites.co.uk%2Ftest2%2Findex.php
- 2
-
ok i read the full tutorial and i didnt understand much of it at all
reduce image file size
in PHP
Posted · Edited by Craig Hopson
ok i now have this function so when uploads are made it will reduce the image file size (a little) and create a thumbnail does it all look ok??
Seems to be working ok only problem is the thumbnails are VERY poor quality any ideas??