Hire a PHP programmer

Started on the old forum in December 2009 · view the original in the archive · old links redirect here

19 replies · 981 views · started 16 years ago · 1 min read

5 participants
mahsing Developer · 60 posts #1

To fix an image resizer script. The script is written in PHP and only a single page. This is use to mobilize an image to downscale to a smaller size.

I would pay $5 to your paypal. If you are interested kindly PM me your msn messenger. Thanks

mahsing Developer · 60 posts #3

unzip the attachment, upload the images.php to your server.

usage: http://<yourdomainname>/images.php?max_width=120&imgfile=<image url>

Example: http://<yourdomainname>/images.php?max_width=120&imgfile=http://www.sun2surf.com/images/sun2surf/articles/41626/1.jpg

This script somehow doesnt work for image url like http://www.sun2surf.com/images/sun2surf/articles/41626/Alimuddin%20Mohd%20Dom.jpg http://www.soccerfanz.com.my/files/preview/0da323cb3a9794a8c6057885fc053a35.75x75.png http://www.hmetro.com.my/Friday/Mutakhir/20091226103646/mainpix

Would really appreciate if someone could help me out of this. 🙂

Attachments: images.zip
subzero Super moderator Fellow · 3,954 posts #4

Do you want to hide your images full stop ?

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

mahsing Developer · 60 posts #5

subzero wrote: Do you want to hide your images full stop ?

nope....a full url....no full stop....just that this forum mark up full url with full stop. 🙂

subzero Super moderator Fellow · 3,954 posts #6

ok i got one some where

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

GiLL Senior · 356 posts #7

Would really appreciate if someone could help me out of this. :)

1.download attached file i added images.php replaced yours also added a font file
2. upload both files on your site in same folder where you want to include
3. use link like yoursite.com//resize.php?image=http://imagesitelink.com/photo.jpg&square=120

now for you to show demo this is real link http://wap4u.in/data/img/JimCarrey7_wap4u.in.jpg

now we are going resize it with width 120

http://wap4u.in/resize.php?image=http://wap4u.in/data/img/JimCarrey7_wap4u.in.jpg&square=120

now we are going resize it with width 50

http://wap4u.in/resize.php?image=http://wap4u.in/data/img/JimCarrey7_wap4u.in.jpg&square=50

do you like it ?if yes use and invite your friends on this forum we dont need 5 dollor thanks

left wap stuff

Attachments: images.zip
GiLL Senior · 356 posts #9

oh you want Resize external links images ? no worry lest use this
but your images links seems broken with space % so might not resize or they might use hot link protection well for me i will show you this new code will work fine with external link

lets say we have a image link

http://3.bp.blogspot.com/_Ajyuy2NzR9Y/SVqoy0ob_lI/AAAAAAAAHhM/SqTouag7u8I/s400/britny-2.JPG

and now we want to rezsize at our site so link will be with w=120&h=120

http://www.wap4u.in/co/index.php?w=120&h=120&img=http://3.bp.blogspot.com/_Ajyuy2NzR9Y/SVqoy0ob_lI/AAAAAAAAHhM/SqTouag7u8I/s400/britny-2.JPG?w=251&h=175&img=http://3.bp.blogspot.com/_Ajyuy2NzR9Y/SVqoy0ob_lI/AAAAAAAAHhM/SqTouag7u8I/s400/britny-2.JPG and also i just google and pick this image link

http://theducks.org/pictures/2003-03-25-workspace.jpg

and we resize it http://www.wap4u.in/co/index.php?w=120&h=120&img=http://theducks.org/pictures/2003-03-25-workspace.jpg

or put any link after = and change w=120&h=120 as you want

http://www.wap4u.in/co/index.php?w=120&h=120&img=

<?php
header ("Content-type: image/jpeg");
/*
JPEG / PNG Image Resizer
Parameters (passed via URL):

img = path / url of jpeg or png image file

percent = if this is defined, image is resized by it's
          value in percent (i.e. 50 to divide by 50 percent)

w = image width

h = image height

constrain = if this is parameter is passed and w and h are set
            to a size value then the size of the resulting image
            is constrained by whichever dimension is smaller

Requires the PHP GD Extension

Outputs the resulting image in JPEG Format

By: Michael John G. Lopez - www.sydel.net
Filename : imgsize.php
*/

$img = $_GET['img'];
$percent = $_GET['percent'];
$constrain = $_GET['constrain'];
$w = $_GET['w'];
$h = $_GET['h'];

// get image size of img
$x = @getimagesize($img);
// image width
$sw = $x[0];
// image height
$sh = $x[1];

if ($percent > 0) {
	// calculate resized height and width if percent is defined
	$percent = $percent * 0.01;
	$w = $sw * $percent;
	$h = $sh * $percent;
} else {
	if (isset ($w) AND !isset ($h)) {
		// autocompute height if only width is set
		$h = (100 / ($sw / $w)) * .01;
		$h = @round ($sh * $h);
	} elseif (isset ($h) AND !isset ($w)) {
		// autocompute width if only height is set
		$w = (100 / ($sh / $h)) * .01;
		$w = @round ($sw * $w);
	} elseif (isset ($h) AND isset ($w) AND isset ($constrain)) {
		// get the smaller resulting image dimension if both height
		// and width are set and $constrain is also set
		$hx = (100 / ($sw / $w)) * .01;
		$hx = @round ($sh * $hx);

		$wx = (100 / ($sh / $h)) * .01;
		$wx = @round ($sw * $wx);

		if ($hx < $h) {
			$h = (100 / ($sw / $w)) * .01;
			$h = @round ($sh * $h);
		} else {
			$w = (100 / ($sh / $h)) * .01;
			$w = @round ($sw * $w);
		}
	}
}

$im = @ImageCreateFromJPEG ($img) or // Read JPEG Image
$im = @ImageCreateFromPNG ($img) or // or PNG Image
$im = @ImageCreateFromGIF ($img) or // or GIF Image
$im = false; // If image is not JPEG, PNG, or GIF

if (!$im) {
	// We get errors from PHP's ImageCreate functions...
	// So let's echo back the contents of the actual image.
	readfile ($img);
} else {
	// Create the resized image destination
	$thumb = @ImageCreateTrueColor ($w, $h);
	// Copy from image source, resize it, and paste to image destination
	@ImageCopyResampled ($thumb, $im, 0, 0, 0, 0, $w, $h, $sw, $sh);
	// Output resized image
	@ImageJPEG ($thumb);
}
?>

Usage examples:

Resize an image to 25 x 25
imgsize.php?w=25&h=25&img=path/to/image.jpg

Resize an image to 50% the size
imgsize.php?percent=50&img=path/to/image.jpg

Resize an image to 50 pixels wide and autocompute the height
imgsize.php?w=50&img=path/to/image.jpg

Resize an image to 100 pixels tall and autocompute the width
imgsize.php?h=100&img=path/to/image.jpg

Resize to 50 pixels width OR 100 pixels tall, whichever resulting image is smaller
imgsize.php?w=50&h=100&constrain=1&img=path/to/image.jpg

working na ?External image (may be gone)

left wap stuff

mahsing Developer · 60 posts #12

I did try to replace this

 $img = $_GET['img'];

with this

 $img = urlencode($_GET['img']);

Seems not working for all external image links.

ranzit2 Developer · 187 posts #13

mahsing wrote: I did try to replace this

 $img = $_GET['img'];

with this

 $img = urlencode($_GET['img']);

Seems not working for all external image links.

hey i am not good with curl.ok now try rawurlencode. Edit--Sorry my bad i had not seen full topic.i dont think curl is used here.i will try to fix it.

she is beautifull than php.and i love her more than php.

mahsing Developer · 60 posts #14

ranzit2 wrote: hey i am not good with curl.ok now try rawurlencode. Edit--Sorry my bad i had not seen full topic.i dont think curl is used here.i will try to fix it.

not working for all external image links.

GiLL Senior · 356 posts #15

as i said url must correct as i show you now it will be waste time nothing else

if url image name or path is without space it will work else not

or some one may know how to solve this issue to fix this

why you want use external links ? what will be if you added all images and that site activate hot link protection ?

you should upload pictures at your site as i think and rename them easy way?

left wap stuff

mahsing Developer · 60 posts #16

GiLL wrote: as i said url must correct as i show you now it will be waste time nothing else

if url image name or path is without space it will work else not

or some one may know how to solve this issue to fix this

why you want use external links ? what will be if you added all images and that site activate hot link protection ?

you should upload pictures at your site as i think and rename them easy way?

I am doing this because i would like to integrate this code to my existing mobilizer script. This mobilizer script helps users to mobilize any websites to fit on their mobile screen.

If the script could handle the url with spaces, then it would be great! 🙂

GiLL Senior · 356 posts #17

mahsing wrote: I am doing this because i would like to integrate this code to my existing mobilizer script. This mobilizer script helps users to mobilize any websites to fit on their mobile screen.

If the script could handle the url with spaces, then it would be great! :)

does that script has register or login system? or just a open download site ?i couldnt find any way to urlencode for external link because seems strange we cant change others url as i know ...

left wap stuff

mahsing Developer · 60 posts #18

GiLL wrote: does that script has register or login system? or just a open download site ?i couldnt find any way to urlencode for external link because seems strange we cant change others url as i know ...

It is just an open service to allow users to mobilize any webpages and downscale all images to fit in on their small mobile screen. Would really appreciate if any gurus here could help on this. 🙂

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close