How do i display a part of the frame? - php

Here is the image :
So now how do i show only the "Red Boxed" part in my frame.
So is there any way i can position my frame or something to that dimensions ?

The short is that if you want to do it with google, you can't. (show a specific part of it)
To show all of it you can:
<iframe src ="http://google.com" width="100%" height="300">
<p>Your browser does not support iframes.</p>
</iframe>
See iframe
You can modify the width and height but you can't say where to start showing (because it's not you page).
The only thing you can do is put some div over it covering some parts
IMPORTANT, THIS IS JUST AN EXAMPLE
From Google's guidelines: Don’t frame or mirror any Google page (including the page that appears in response to a click on the Google logo or Google search box).
Thanks #Gordon!
Good luck!

with PHP you can retrieve the html and than quite easily edit it pragmatically.
Or try and use HTML FRAME Attributes... http://www.w3schools.com/tags/tag_frame.asp
The latter will only work if you try to get a part of your own page, and not google's..

Related

Getting the size of an iframe or screen using PHP

I have an iframe that shows a picture generated by a software on the server. The image size is sent in pixels to the software by a parameter in the command line.
The iframe size is set relatively, using <iframe width="100%" >, no problem with that. But in small screens, if the iframe gets smaller than the picture it causes a bad effect, with undesired scroll bars to show the hidden parts of the image.
Is there a way to know the size of the iframe in the browser, or the screen itself, so I can send the correct size to generate a picture that will fill properly in the iframe?
(I guess this is used by responsive themes)
EDITION: I'm reasking this in another way here How to make it sure that an iframe content fits it?
The best approach would depend on the method in which the image is loaded into the iframe. The size of the iframe would have to be determined on the client end, so it would be out of reach for PHP.
I'd personally load the image with PHP on the server end and avoid iframes. If you are loading the image after the page is loaded, you might want to reset the iframe's size using javascript(or jQuery).
If you could provide more detail about how the image is loaded into the iframe, it would help figure out what exactly you're looking for.

Iframe in mobile devices - how automatically change height of the Iframe when the width of the window is changed in any devices

I have A problem in my shortener website this is iframe
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item" src="<?=$adurl?>"></iframe>
the websites in iframe appear on desktops good without problems but in mobile devices the iframe appear short from the bottom how make the websites appear full size in iframe automatically change size full in any devices
Thanks for the help advance
Its kinda hard to read your question since you didn't use punctuation, but I think you need to have a look at this SO question.
And you need to close your <div> with </div>, but I think that that is just a copy/paste mistake.

Wordpress Embedded Video Issue

I am having difficulty with a Wordpress site that has already been pretty heavily customized. Suddenly, one of the pages simply stopped working!
The issue is that when clicking a video link, a lightbox clone (prettyPhoto) is supposed to show the youtube video, but instead the popup message "Image cannot be loaded. Make sure the path is correct and image exist." displays.
Here is what I have learned so far on the issue through a lot of research and exploring the code:
The page is composed of individual posts and the images that the anchor tag is surrounding are generated using the video thumbnail of each post.
The posts themselves are merely a YouTube link "ex: http://www.youtube.com/watch?v=LdOKJ7cybi4" with a title and a video thumbnail.
The issue seems to be caused by the href attribute that Wordpress generates. Using the above youtube link example, it supplies a href attribute like this (it actually puts the span tags and everything inside of the href attribute):
<span class='embed-youtube' style='text-align:center; display: block;'>
<iframe class='youtube-player' type='text/html' width='640' height='390' src='http://www.youtube.com/embed/LdOKJ7cybi4?version=3&rel=1&fs=1&showsearch=0&showinfo=1&iv_load_policy=1&wmode=transparent' frameborder='0'></iframe>
</span>
When I remove the span tags and all contents and replace it with the content of the post (ex: http://www.youtube.com/watch?v=LdOKJ7cybi4), then it works! But, I can't figure out how to make it use the YouTube link that was typed into the post, rather than generating these excessive and unneccessary span tags.
Help please!
It seems like wordpress is formatting your text. there are several plugins available to stop this happening for eg :
http://wordpress.org/support/view/plugin-reviews/ps-disable-auto-formatting
However, given that your site is already highly customized I would recommend exercising caution and perhaps backing up first.

PHP to view PDF on web page and disable user to download

I'm going to write a site that lets users to view pdf files but I don't want them to save the files to their own hard drive due to the copy right law. I'm researching how to view it by using PHP, but I have no idea how to disable user not to download the files.
Actually, I want to use JavaScript to disable this action, but I get suggestions from other people not to do so because it's annoying to user.
So any suggestion or help would be very much appreciated.
USE CSS opacity: 1.0 with a <div> positioned over your content...
You could output the pdf using <object> or <iframe>, then place a with absolute position and use z-index to cover your pdf. Use the css opacity: 1.0.
Now when users try to click or copy, they get nothing because they are really clicking on a blank <div>!!!!
Its a hack, but it works! The user will be able to read the content, they could take a screen shot, but they won't be able to actually copy the text and paste it anywhere.
Method 01
Implementing that useing Google books
<iframe frameborder="0" scrolling="no" style="border:0px" src="https://books.google.com.kh/books?id=e5MkzETNcsgC&lpg=PP1&dq=typography&pg=PA11&output=embed" width="500" height=500>
</iframe>
In above image it shows Embed that will be the code. And Download or Print option is not available on this. Google dosc can prevent download but its allow to Save to Drive option. Then in drive i can download it. But Google books not allow any of that.
in view
Method 02
Using Google Drive
Right click on pdf and goto Share(below image)
Then go to Advanced option in left bottom
Tick Both check boxes. After copy embed link and paste it to your src. No download and Save drive option is not allowed
Note: Method 01 and Method 02 is Tested
You can't prevent your visitors from downloading, copying or scrapping anything you're outputting to their browsers. If they can view it they can always screenshot it. Which brings in the optimal solution to your problem: Simply offer image copies of your documents instead of actual PDF files. You can convert / mass convert PDF files to JPEG easily with Photoshop.
I hope I am not very late to reply. But here's is something you can do to prevent the users. Use iFrame to display your PDF and make sure that you are displaying using Google. I used the following code :
<iframe src="http://docs.google.com/gview?url=http://www.tutorialspoint.com/php/php_tutorial.pdf&embedded=true" style="width:600px; height:500px;" frameborder="0">
</iframe>
Here you can simply change the url=http://www.tutorialspoint.com/php/php_tutorial.pdf and replace it by your own URL where you kept your PDF.
Try this one:
<iframe src="test1.pdf" scrolling="no" frameborder="0" height="100%" width="100%" style="position:absolute; clip:rect (190px,1100px,800px,250px);">
try this
<embed src="http://URL_TO_PDF.com/pdf.pdf#toolbar=0&navpanes=0&scrollbar=0" width="500" height="500">

Expand a link to show image without using javascript

I have a page with some text and links. I want to display image there itself on clicking those links. However, I am bound of not using javascript at all. All I can use is some server side component like PHP.
Thanks
Since you stated in a comment that you don't want to reload the page and can't use Ajax, PHP won't help you because it runs on the server. Instead, you can achieve what you want with CSS. Have a look at this simple demo.
Basically, you put the image inside the link:
link text <img src="...">
and then specify in your CSS something like:
a img {display:none}
a:visited img {display:inline}
so the image is hidden by default, but once the user clicks on the link, the image is displayed. If you have several images on your page, you must assign each link a different href anchor:
link text <img src="...">
link text <img src="...">
One potential issue with this approach is that once a user has revealed a particular image, that image will also be revealed by default on that user's subsequent visits to that page unless he clears his browser history. If you want to prevent that from happening, i.e. always hide all images by default, then, for example, your PHP code could generate random href anchors each time.
This is entirely possible, but you have to tolerate the fact that when the user clicks on the link, the page will have to reload in order to show the image.
So, basically, your links will be something like this:
http://myserver/myscript.php?id=0
And then your PHP will include an IMG tag for the appropriate image, perhaps like this:
$id = $_GET['id'];
echo "<img src='/images/image_$id.jpg'>\n";
If you were able to use Javascript you could have it work without needing to reload the page, but apart from that, doing it with PHP should be fine.

Categories