preview of another website not thumbnails in php and javascript - php

I am in the process of creating a site where visitors can preview(not THUMBNAILS!) another url on mypage in an input text box and click on"preview" button-
I am using CURL from php to extract the contents of the site
and have divided my page into two halves one for accepting url and the other half which will display the previewed content, basically i do not want image of the url site like GOOGLE.
though the CURL fetches me the contents and I am able to see the content on the preview half what is annoying is the CSS of the previewed html is getting applied across even my page :(
since my knowledge of css is very limited can anyone help me with the following
css of the previewed section must not get applied to my part of the page
How to scale down the previewed site just to fit into the preview section of my page.
thanks,
Jay

Use an iframe to keep the preview site separate from your own. Something like this should work:
<iframe id="preview" src="about:blank"></iframe>
<script>
function previewUrl(location) {
document.getElementById('preview').src = location;
}
</script>

Related

FB Share pop-up different window than what is posted

I'm new to using the FB share buttons terminology so forgive me if I use the wrong syntax in describing this.
My site is setup to load pages based on the passed parameters in the URL (...?page=somepage&imageid=idnum).
So I have my index file which contains my head, as well as sidebar, etc. Then my main body is generated according to the passed parameter. Simple Enough.
On the homepage, the main body is a gallery of images. When they click on one of those images it takes them to a page that just displays that one image. The page is loaded with parameters of ?page=detail&image_id=1 /*or whatever the id of that image is */
So when they click on the share on FB button on those individual images page, I would like it to populate with the image that is displayed on that page. What I have done is included a php file in my head tag. The php script included gets the page info and passed parameters and then fills out the image url based on the imageid.
echo '<meta property="og:image" content="http://www.chiseledimages.com/clients/vote/'.$imgurl.'"/>';
This works in that when displaying the page source, the meta tag with og:image shows perfectly, also in that when I run it through the FB Object debugger, it gets the correct image and doesn't show me any errors. It even posts the correct image when the users shares on their wall. What is does not do, is show the correct image in the pop window after the uses presses the share button on my site. So even though the result is what I want, the problem with the user not seeing the correct image in the share pop-up, may lead them not to want to share on their wall.
Current location of site: http://www.chiseledimages.com/clients/vote/
Example of a specific pages: http://chiseledimages.com/clients/vote/?page=detail&angel_id=1
Screenshots of pop-up with wrong image, but final posted story having correct image.
How can I make the image in the pop-up match the image that is going to be shared. Thanks.
Edit: I forgot to mention and I'm sure it matters that I'm using Addthis to implement the FB share.
Check https://developers.facebook.com/docs/reference/dialogs/feed/ - look for the 'picture' parameter description
I suggest to you use this http://support.addthis.com/customer/portal/articles/1365475-attribute-based-configuration#.UwPQB6LW6So. just follow their example and you good to go.

How to open image href on a aspx page

When the thumbnail is clicked I would like the full size image to open on http//example.com/image.aspx instead of http//example.com/images/image.jpeg without creating an individual page for each image and editing each href. I know that this is possible with php but I was wondering if there was some way of doing it with javascript, jquery, asp.net, or...? If it is possible, (I maybe stretching it here), would it also be possible to run this on the master page for all thumbs? The thumbs have no class or id. Right now they are in straight html markup. I have searched for days and have found nothing that would even get me started on the correct path with the exception of php. I don't need the target blank if I could implement this because this would allow me to open the image on a aspx content page with full site navigation. Here is the code as of right now.
<a target="_blank" href="image.jpg/jpeg"><img alt="something" src="pictures/image_small.jpg/jpeg"></a>
A page from our site is http://backalleypics.com/PeoplesPages/Sa~Se/SarahShahiPages/SarahShahi1.aspx. An example of the php type is http://www.theplace2.ru/photos/gallery.php?id=47 I really don't want a gallery, pop up window, or light box. The purpose is to get ad views for each image click and have navigation on the page.
You can use an existing library that do that, like the: http://highslide.com/
There are also many others, some of them:
http://www.dynamicdrive.com/dynamicindex4/thumbnail.htm
http://valums.com/javascript-image-galleries/

Capturing the image view count on click while using jquery fancybox

does anyone have an idea on how I could capture the image id when a user clicks the next / previous button in Fancybox? I like how Fancybox changes depending on the size of the image so I prefer to use this over some of the other galleries that I have seen. Has anyone successfully done this? The site is in PHP.
The general idea would be to "proxy" your images by a PHP script.
This script would:
add 1 to the view count of the image
serves the image to the browser (instead of serving an HTML page as usual)
You would then update the src attribute of your pictures img tag :
<img src="mypicture.png"/>
would become
<img src="view_picture.php?picture=1"/>
Note that you must be careful and not authorize a filename in the picture parameter and/or carrefully check that the user is not trying to see a file that you don't want to show him (think view_picture.php?picture=../.htpasswd )
Consider using a general website analytics software, like Piwik. This will give you additional insights on you visitors and their actions on your site, rather than a simple image view counter.
I am running a site that uses Fancybox and Piwik, all image views through Fancybox will automatically show up in the Downloads section of Piwik reports without any additional configuration.
But you could easily customize this through Fancybox's onComplete callback and Piwik's trackPageView(). See Piwik Javascript API and Fancybox API for details.

how to first load an image in webpage

i have a question to ask you. So I have on my webpage a showcase that has some images that keep playing. I used JCarousel to build it. The thing is that when i first enter on the page i can't see the image or I see only a part of it. I suspect that this is because the site a few seconds while it loads all the images it has. My question is: how can I make certain images be the first ones to be loaded? Or how can I prioritise the way the images load on the page? By the way I'm doing this in html,php using javascript and ajax and the images are taken from a database.
Thank you very much!
If you Base64 encode them, you can put them in the CSS, or HTML. It will really increase the side of a page, so perhaps encode a low resolution picture, and then replace it with highres when it loads. That is, a preview image.
Try this tool/guide.

Display user created invalid HTML content without messing up the page

I have a website that allows a user to save text content and then display it as is.
The user can use HTML tags to create his data the way he wants - design, fonts, divs, tables and so on...
To display the data been saved I direct the user to a page with a header/footer of my own and he's data in the middle. The problem happens when the user has some invalid HTML tags or un-closed ones, then it interfere with my own header/footer HTML and the whole page gets messed up.
Is there a way to encapsulate the user's data so it would not harm the page?
You can try to load it in iframe. Haven't tested it, but I think it should work.
you can use iframe with fixed width and height.
The Iframe suggestion are good but was not enough. Because i wanted it to show like it was a part of the page and I didn't know what is the length and size of the user data, the solution i've used is like that:
Created a page that shows the user data alone. Opened it in an iframe which was located between my main page header and footer.
Now for the trick - for when the user has a lot of data, to avoid scroll bars in the middle of the page i have used this script on the iframe onload event:
function setHeight()
{
//get page height
var the_height=
document.getElementById('userFrame').contentWindow.document.body.scrollHeight;
//set iframe height
document.getElementById('userFrame').height=the_height;
}
This way, when the page loads, the iframe height will change according to it's size, pushing the footer to the bottom.
After that just needed to set the iframe border to "none" and the page looks normal.

Categories