maddali Posted February 12, 2010 Share Posted February 12, 2010 Hi folks, I'm stuck up with a function(or) code I need to implement.I need to get the images from an url(which actaully are in the local server) dynamically and display them as a thumbnail....here is the link I'm talking about to get a clear idea http://omars.gmu.edu/items ...an image should be displayed on the left of every item that is displayed... Here is how an image is to be retrieved...when I click on any item it redirects to another page,which on this page will be http://omars.gmu.edu/items/show/2536,when clicked on "Paper: "The Center for Interactive Management," October 1981"...When the page is scrolled down,an Identifier tag can be seen which has an url...when clicked on that,it again redirects to the link provided...the clickable version of the page is not updated yet...sorry for the inconvenience....Finally,this page contains some images,pdf,documents which should be displayed as a thumbnail in the browse items page I'm worrying about http://omars.gmu.edu/items... Any help is greatly appreciated.... Quote Link to comment https://forums.phpfreaks.com/topic/191883-getting-image-from-url-dynamically/ Share on other sites More sharing options...
ram4nd Posted February 12, 2010 Share Posted February 12, 2010 What do you mean by getting image from url? There are no images in url. Quote Link to comment https://forums.phpfreaks.com/topic/191883-getting-image-from-url-dynamically/#findComment-1011509 Share on other sites More sharing options...
mikesta707 Posted February 12, 2010 Share Posted February 12, 2010 im assuming by image from url, you mean you need to get a certain image from a certain page (that certain page residing at the URL in question) There are numerous ways to do it, but using the Curl library, or simply using the file_get_contents() function will get the raw html of the page. From there you could simply use regex or the html DomDocument class to get the image you want Quote Link to comment https://forums.phpfreaks.com/topic/191883-getting-image-from-url-dynamically/#findComment-1011516 Share on other sites More sharing options...
maddali Posted February 12, 2010 Author Share Posted February 12, 2010 Hi Ram, http://omars.gmu.edu/items/show/2536,when clicked on "Paper: "The Center for Interactive Management," October 1981",it rediects to the page which has a label named "Identifier"....It has an url which is http://hdl.handle.net/1920/5657 in this case,and it is different for every item in every collection..And finally when clicked on that link,infact,the main page that contains pdfs,images,docs that are click-able/download able(sorry for the server is down right now, you cannot view this page)...What I'm supposed to do is get the images/docs/pdfs from that page and display them as a thumbnail in thishttp://omars.gmu.edu/items/show/2536 page.... In short,I need to get images/docs/pdfs from http://hdl.handle.net/1920/5657 and display that as a thumb nail in http://omars.gmu.edu/items/show/2536...and should be same for every item wehn browsed.... Maddali Quote Link to comment https://forums.phpfreaks.com/topic/191883-getting-image-from-url-dynamically/#findComment-1011531 Share on other sites More sharing options...
maddali Posted February 12, 2010 Author Share Posted February 12, 2010 Hi Mikesta, Thanks for the reply,that's exactly what I'm talking about...Is it possible to retrieve the links of image/docs/pdfs that is on the remote server and get it displayed as thumbnail,that corresponds to each item...Also,when I roll over my mouse over the different images,pdfs,docs in different items or collections,I noticed that they have some part of url in common,which are stored in the server...However,I couldn't manage to get a function that does my task,which I think is beyond my knowledge...could you please help me providing a sample code/function that works in my case.... Thanks, Maddali Quote Link to comment https://forums.phpfreaks.com/topic/191883-getting-image-from-url-dynamically/#findComment-1011536 Share on other sites More sharing options...
mikesta707 Posted February 12, 2010 Share Posted February 12, 2010 well, if you have the raw html, a simple regular expression (regex) would probably do the trick. Can you give a couple example urls? preg_match() regex function: http://php.net/manual/en/function.preg-match.php site with regex tutorials http://www.regular-expressions.info/ a basic example would be like //get html from page. store in variable $html; $pattern = '#generic/part/of/url/(.+?)#i'; if (preg_match_all($pattern, $html, $matches)){ array_shift($matches);//take out first entry because it is entire match, which we dont need print_r($matches);//show array structure Quote Link to comment https://forums.phpfreaks.com/topic/191883-getting-image-from-url-dynamically/#findComment-1011540 Share on other sites More sharing options...
maddali Posted February 12, 2010 Author Share Posted February 12, 2010 hi thanks for the links...here are the example urls http://omars.gmu.edu/items When clicked on Paper: "The Center for Interactive Management," October 1981,it redirects us to http://omars.gmu.edu/items/show/2536....and when clicked on the http://hdl.handle.net/1920/5657 below the Identifier,a new page pops-up where the images/docs can be viewed....I need them to placed as thumbnails on the left of the title Paper: "The Center for Interactive Management," October 1981 in this page http://omars.gmu.edu/items.... similarly,when clicked on Paper: "Major Impacts from Recent Applications of Interactive Management (April 1983-July 1988)",an identifier with linkhttp://hdl.handle.net/1920/5655 can be found down the page,when clicked redirects to the page with same url having images/docs/pdfs...same thing is expected to happen..getting an image/docs/pdfs and displaying them as thumbnail beside Paper: "Major Impacts from Recent Applications of Interactive Management (April 1983-July 1988)" in http://omars.gmu.edu/items I'm expecting a function or code that does the same thing dynamically for all the items on that webpage....the link provided in the identifier cannot be accessed now as the server is down... Thanks, Maddali Quote Link to comment https://forums.phpfreaks.com/topic/191883-getting-image-from-url-dynamically/#findComment-1011551 Share on other sites More sharing options...
maddali Posted February 13, 2010 Author Share Posted February 13, 2010 Can somebody help me out giving a sample code in this case??? Maddali Quote Link to comment https://forums.phpfreaks.com/topic/191883-getting-image-from-url-dynamically/#findComment-1011897 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.