/    Sign up×
Community /Pin to ProfileBookmark

How to get file width, height if url does not have file extension?

I’m looking the way to save img file from url that does not have file extensions in the end. For example when i trying to save this image, I get the error:

[url]http://pics.livejournal.com/psychiatrique/pic/0024yet5[/url]

[B]Unable to get the length and width of the image. Failed to read file.[/B]

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@vojaAug 27.2011 — If you want to resize the image, I think you can create a temporary file using GD image library and save it on your server, then read the image width and height and resize.
Copy linkTweet thisAlerts:
@ijsauthorAug 27.2011 — What is GD?
Copy linkTweet thisAlerts:
@NogDogAug 27.2011 — Assuming allow_url_fopen is enabled in your PHP config:
[code=php]
<?php
$info = getimagesize('http://pics.livejournal.com/psychiatrique/pic/0024yet5');
echo "<pre>".print_r($info, true)."</pre>";
[/code]
Copy linkTweet thisAlerts:
@vojaAug 27.2011 — GD is library for image processing. Here's the list of functions you can use: http://www.php.net/manual/en/ref.image.php

NogDog has already written an example - thanks.
Copy linkTweet thisAlerts:
@ijsauthorAug 28.2011 — Voja, NogDog, thank you so much. I'll explore it.
×

Success!

Help @ijs spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...